bacalhau-project / bacalhau

Compute over Data framework for public, transparent, and optionally verifiable computation
https://docs.bacalhau.org
Apache License 2.0
704 stars 89 forks source link

NATS server does not stop on bind failure #3649

Open rossjones opened 8 months ago

rossjones commented 8 months ago

If the NATS server attempts to start on a port, but that port is in use, an error is logged but processing does not stop.

In tests, if the port is in use from a previous test, then this results in authorization failures as the current test attempts to connect to the NATS from the previous test.

Currently we as nats to start with go ns.Start() , with no way of returning an error.

Perhaps we might extend pkg/lib/network to check if specific ports are free. This will not be perfect but will catch the most obvious cases.

rossjones commented 8 months ago

Partial fix available in 54af2cf06 and 252e88afeac4ca0e0bb0941552a0dac72febe0f3

wdbaruni commented 6 months ago

checking for ports is more of a workaround as it won't help against race conditions. It can be a quick fix, but we might need to look into proper way to initialize nats and capture initialization errors