We run linux userspace click under the runit process supervisor. Sometimes click coredumps for one reason or another, and when restarting click we encounter errors about "address already in use", sometimes from the click control socket file, and sometimes from other unix socket files.
Socket and ControlSocket cleanup code will attempt to remove the
unix socket files they create. However, if click were to crash or
otherwise exit without calling cleanup, click will require an operator
to intervene and delete any unix socket resources not removed.
This change places an unlink() call before calls to bind() where
a unix socket is used. No error or logging is handled since it
is a best effort attempt to cleanup the unix socket.
I haven't done much evaluation on what the side effects might be, but I believe there aren't any? Feedback is appreciated, and I hope this helps.
We run linux userspace click under the runit process supervisor. Sometimes click coredumps for one reason or another, and when restarting click we encounter errors about "address already in use", sometimes from the click control socket file, and sometimes from other unix socket files.
Socket and ControlSocket cleanup code will attempt to remove the unix socket files they create. However, if click were to crash or otherwise exit without calling cleanup, click will require an operator to intervene and delete any unix socket resources not removed.
This change places an unlink() call before calls to bind() where a unix socket is used. No error or logging is handled since it is a best effort attempt to cleanup the unix socket.
I haven't done much evaluation on what the side effects might be, but I believe there aren't any? Feedback is appreciated, and I hope this helps.