click icon indicating copy to clipboard operation
click copied to clipboard

Make sure that UNIX sockets are removed before binding to them

Open klanmiko opened this issue 4 years ago • 0 comments

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.

klanmiko avatar Aug 10 '21 02:08 klanmiko