Hi Takeshi,

On Sat, Jul 11, 2020 at 04:44:41PM +0000, mizuta.take...@fujitsu.com wrote:
> If multiple haproxy are started under these specifications, the behavior as:
> 
>  - in daemon mode
> 
>    Run  /usr/sbin/haproxy -D -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid,
>    then /usr/sbin/haproxy -D -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid.
> 
>     - The pidfile created by the former is overwritten by the latter.
>     - The contents of the pidfile are pids for the latter nbproc.
>     - The haproxy processes have been started for both the former and the 
> latter.
(...)

But this is not the correct behavior, I mean, you're not supposed to be
purposely starting multiple processes in parallel on a same pid file. Same
for the master-worker mode.

The purpose of the pidfile is to be usable to send the reload signal from
external tools or scripts, so the second process is expected to have either
-sf or -st <pid>.

Now if you're talking about a case where it is run by accident, this is
different, but in this case the pidfile is not the right way to address
such operational mistakes. One of them is to set "noreuseport" on a bind
line to prevent the new process from binding to the same address as the
old one. In this case the new process will fail to start and your pidfile
remains safe.

Hoping this helps,
Willy

Reply via email to