Re: Stale UNIX sockets after reload

2016-05-10 Thread Willy Tarreau
On Tue, May 10, 2016 at 04:01:24PM +0200, Mehdi Ahmadi wrote:
> In the case of `stop` - I image that the stale / former sockets can be
> listed using:
> `sudo lsof | grep SOMETHING` ?

No since there's no more process. What you see is just a file system
entry. If you try to connect to it using socat, you'll see "connection
refused" which indicates there's nobody there anymore.

> I'm wondering if an additional shell level checks / cleanup can be done in
> such cases were related PID's would be killed? - or perhaps there's a core
> part to how socets are created and managed that I'm lacking.

It could, but it's dangerous as the script would have to guess the paths
correctly from parsing the haproxy config... Or you could put all of them
into a dedicated subdir and remove them on stop. But even then it will not
scale well with multiple instances.

I'd really suggest to place them somewhere it cannot bother you and ignore
them. /var/run is quite common for this, example :

  $ find /var/ -type s 2>/dev/null 
  /var/run/acpid.socket
  /var/run/rpcbind.sock
  /var/run/dbus/system_bus_socket

Willy




Re: Stale UNIX sockets after reload

2016-05-10 Thread Mehdi Ahmadi
In the case of `stop` - I image that the stale / former sockets can be
listed using:
`sudo lsof | grep SOMETHING` ?

I'm wondering if an additional shell level checks / cleanup can be done in
such cases were related PID's would be killed? - or perhaps there's a core
part to how socets are created and managed that I'm lacking.

Thanks for the input Willy! :-)


On Tue, May 10, 2016 at 2:15 PM, Willy Tarreau  wrote:

> On Mon, May 09, 2016 at 04:12:32PM +0200, Pavlos Parissis wrote:
> > On 09/05/2016 02:26 , Christian Ruppert wrote:
> > > Hi,
> > >
> > > it seems that HAProxy does not remove the UNIX sockets after reloading
> > > (also restarting?) even though they have been removed from the
> > > configuration and thus are stale afterwards.
> > > At least 1.6.4 seems to be affected. Can anybody else confirm that?
> It's
> > > a multi-process setup in this case but it also happens with binds bound
> > > to just one process.
> > >
> >
> > I can confirm this behavior. I don't think it is easy for haproxy to
> > clean up stale UNIX socket files as their names can change or stored in
> > a directory which is shared with other services.
>
> In fact it's not exact, it does its best for this. The thing is that upon
> a reload it's the new process which takes care of removing the old socket
> and it does so pretty well. But if you perform a stop there's no way to
> do it if the process is chrooted. In practice many daemons have the same
> issue, that's how you end up with /dev/log even when syslogd is not running
> or with /tmp/.X11-unix/X0 just to give a few examples.
>
> Hoping this helps,
> Willy
>
>
>


Re: Stale UNIX sockets after reload

2016-05-10 Thread Willy Tarreau
On Mon, May 09, 2016 at 04:12:32PM +0200, Pavlos Parissis wrote:
> On 09/05/2016 02:26 , Christian Ruppert wrote:
> > Hi,
> > 
> > it seems that HAProxy does not remove the UNIX sockets after reloading
> > (also restarting?) even though they have been removed from the
> > configuration and thus are stale afterwards.
> > At least 1.6.4 seems to be affected. Can anybody else confirm that? It's
> > a multi-process setup in this case but it also happens with binds bound
> > to just one process.
> > 
> 
> I can confirm this behavior. I don't think it is easy for haproxy to
> clean up stale UNIX socket files as their names can change or stored in
> a directory which is shared with other services.

In fact it's not exact, it does its best for this. The thing is that upon
a reload it's the new process which takes care of removing the old socket
and it does so pretty well. But if you perform a stop there's no way to
do it if the process is chrooted. In practice many daemons have the same
issue, that's how you end up with /dev/log even when syslogd is not running
or with /tmp/.X11-unix/X0 just to give a few examples.

Hoping this helps,
Willy




Re: Stale UNIX sockets after reload

2016-05-09 Thread Pavlos Parissis
On 09/05/2016 02:26 μμ, Christian Ruppert wrote:
> Hi,
> 
> it seems that HAProxy does not remove the UNIX sockets after reloading
> (also restarting?) even though they have been removed from the
> configuration and thus are stale afterwards.
> At least 1.6.4 seems to be affected. Can anybody else confirm that? It's
> a multi-process setup in this case but it also happens with binds bound
> to just one process.
> 

I can confirm this behavior. I don't think it is easy for haproxy to
clean up stale UNIX socket files as their names can change or stored in
a directory which is shared with other services.

Cheers,
Pavlos




signature.asc
Description: OpenPGP digital signature


Stale UNIX sockets after reload

2016-05-09 Thread Christian Ruppert

Hi,

it seems that HAProxy does not remove the UNIX sockets after reloading 
(also restarting?) even though they have been removed from the 
configuration and thus are stale afterwards.
At least 1.6.4 seems to be affected. Can anybody else confirm that? It's 
a multi-process setup in this case but it also happens with binds bound 
to just one process.


--
Regards,
Christian Ruppert