When assigning ephemeral ports for use by the Temporal Server, on all platforms except MacOS and Windows, immediately open a connection to that port, and force the connection into TIME_WAIT state. This avoids various race conditions that could happen due to the port being reallocated between the moment the port is obtained and the moment the server actually binds to that port. Resolves #550.
Add checks to assert that ports provided by the user are indeed free; this would previously cause a SIGSEGV. Resolves #543.
Note that these checks are subject to race conditions (that's essentially a check-before-use sequence), though such race occurrences are very unlikely for ports numbers that have been specifically requested by the user.
Added tests to confirm that it is possible to start multiple dev server concurrently.
What changed
When assigning ephemeral ports for use by the Temporal Server, on all platforms except MacOS and Windows, immediately open a connection to that port, and force the connection into
TIME_WAIT
state. This avoids various race conditions that could happen due to the port being reallocated between the moment the port is obtained and the moment the server actually binds to that port. Resolves #550.Add checks to assert that ports provided by the user are indeed free; this would previously cause a SIGSEGV. Resolves #543.
Added tests to confirm that it is possible to start multiple dev server concurrently.