Closed rwmjones closed 2 months ago
(Adding @ebblake)
It would also be nice to have systemd-style socket activation, where the parent can pre-open a socket and pass one end into the child along with details in LISTEN_* environment variables, which avoids the need for the parent to wait for a pid file to appear at all.
This could be interesting, but it's not something that really is in the scope of this project since it's intended for the for use as a library and does intentionally not vendor any ready-to-use binaries. The library itself makes no assumptions about how you start the server not does it start the listener; you can achieve the desired effect by writing the PID file after you start the listener here.
I'm trying to write an automated interop test for libnbd & go-nbd.
However there seems to be know way to know when the server is ready and listening for requests. This is most obviously a problem if you have a test which does:
Normally we would want to have the server write a PID file when it has finished starting up and is listening for requests (note: the PID file should be written after the listening socket is opened). In the client side of the test we would wait for this file to appear.
But as go-nbd doesn't seem to do that, there's no way to safely start the test in a race-free way.