Hi Lukas,
On 04/10/2017 22:01, Lukas Tribus wrote: > I guess the problem is that when a reload happens before a restart and > pre-reload > systemd-wrapper process is still alive, systemd gets confused by that old > process > and therefor, refrains from starting up the new instance. > > Or systemd doesn't get confused, sends SIGTERM to the old systemd-wrapper > process as well, but the wrapper doesn't handle SIGTERM after a SIGUSR1 > (a hard stop WHILE we are already gracefully stopping). > > > Should the systemd-wrapper exit after distributing the graceful stop message > to > processes? I don't think so, it sounds horribly. > > Should the systemd-wrapper expect a SIGTERM after a SIGUSR1 and sends the > TERM/INT to its childs? I think so, but I'm not 100% sure. Is that even the > issue? > > > > We did get rid of the systemd-wrapper in haproxy 1.8-dev, and replaced it > with a > master->worker solution, so I'd say there is a chance that this doesn't > affect 1.8. > A. It appears to me that it is not the wrapper that receives the SIGUSR1 but the haproxy process. B. Here is how I technically explain the "bug" (to be confirmed by the Devs) reported by Niels: - During the reload: 1. A SIGUSR2 is sent to the systemd-wrapper 2. The wrapper sends SIGUSR1 to haproxy processes listed in the pid file. 3. A new haproxy process is listening for incoming connections and the pid file now contains only the pid of the new process. - Then when issuing a restart/stop: 1. A SIGTERM is sent to the systemd-wrapper 2. The wrapper sends SIGTERM to haproxy processes listed in the pid file. 3. Only the new haproxy process is stopped the other one is still there since it did not receive the SIGTERM - This why systemd is getting confused and after the timeout systemd gets done with this by sending a SIGTERM to all child process (killmode=mixed policy) C. I was able to verify this by doing the following: 1. After the reload I manually add the old process pid to the pidfile 2. Then When I hit restart, all process are stopped correctly. So the question is ( @William ): when doing a soft stop should we preserve old process pid in the pidfile until the process terminates ? -- Moemen MHEDHBI

