sane way of cleaning up stale unix sockets?

Valentin V. Bartenev vbart at nginx.com
Tue Dec 22 14:12:09 UTC 2020


On Saturday, 19 December 2020 18:48:02 MSK Александр Поволоцкий wrote:
> Hello
> 
> Sometimes unitd leaves behind orphaned unix sockets (well, just 
> configure it to use some and kill -9!)
> 
> On next start, unitd fails to start because of existing sockets.
> 
> Is there a sane way to clean up them on start? keeping separate list of 
> sockets-to-remove is a clear way to insainty.
[..]

Hello,

Indeed, this is a problem.  That's the reason why the usage of unix sockets
in listeners is still undocumented.

It's not so easy to fix, because we need to avoid the situation when the socket
is used by some other processes and avoid any possible race conditions
here.

Actually, until it will be fixed I have no better idea than put them all in the
same dedicated directory and just clean up everything in it each restart.

  wbr, Valentin V. Bartenev





More information about the unit mailing list