mitre / hipcheck

Automatically assess and score software repositories for supply chain risk.
https://mitre.github.io/hipcheck/
Apache License 2.0
80 stars 6 forks source link

hc fails to start plugins on macOS #600

Closed patrickjcasey closed 1 week ago

patrickjcasey commented 2 weeks ago

Image

patrickjcasey commented 2 weeks ago

This issue seems to reliably manifest itself when running hc check if another instance of hc check is running

alilleybrinker commented 2 weeks ago

Hm. This is true for you even after the tuning we did yesterday for macOS spawn timing?

patrickjcasey commented 2 weeks ago

Yes this is triggering with the latest version of main. To add more detail, the plugins are able to all bind to the ports handed to them by hc, but the function call PluginServiceClient::connect(format!("http://127.0.0.1:{port_str}")).await in hipcheck/src/plugin/manager.rs fails with a generic transport error from tonic

alilleybrinker commented 2 weeks ago

Exciting! I think this is probably a race condition on automatic port assignment in macOS. We'll want to dig in further, and this does evince the need to establish some sort of exclusion through locking the shared resources (repo cache, plugin cache) that Hipcheck has; alongside avoiding a data race on port assignment from the OS.