Good catch Claudio. The bug is present in Trusty and Trusty-backports. Prior to LP: #1477198, the stop script did not stop at all because it relied on the --pid option that is introduced in dpkg version 1.17.6 as outlined in the man page of start-stop-daemon :
[--pid] pid Check for a process with the specified pid (since version 1.17.6). The pid must be a number greater than 0. Now with the fix introduced by LP: #1477198, it will work as expected unless nproc > 1. Otherwise, we will see the behavior described in LP: #1481737 whereas processes other than the first PID appearing in the pidfile will remain active. The patch included here solves both situation as it loops through all the PIDs in the pidfile & terminates them using a temporary pidfile. I will carry on this explanation in the other bug so the version in -updates is fixed as well. This bug remains valid as we still see only the first PID being killed with the recent patch. -- You received this bug notification because you are a member of Ubuntu High Availability Team, which is subscribed to haproxy in Ubuntu. https://bugs.launchpad.net/bugs/1494141 Title: HAProxy 1.5 init script does not terminate processes Status in trusty-backports: In Progress Status in haproxy package in Ubuntu: Fix Released Status in haproxy source package in Trusty: Invalid Bug description: On a new installation of Ubuntu 14.04.3 LTS I installed HAProxy 1.5 from trusty-backports (1.5.4-1ubuntu2.1~ubuntu14.04.1). When I restarted HAProxy, I got random HTTP 503 although the backend servers were all working fine. By checking netstat, I saw that HAProxy was listening multiple times on the frontend ports. It seems that the init script coming with the installation does not work correctly. The processes are not terminated correctly when using stop (or restart, in this matter, either). Only with a kill I was able to correctly terminate the HAProxy processes. The following output should show more clarity: root@mylinux:~# netstat -lntp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 4653/haproxy tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 4221/haproxy tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 956/nginx tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 855/sshd tcp 0 0 0.0.0.0:8090 0.0.0.0:* LISTEN 4653/haproxy tcp 0 0 0.0.0.0:8090 0.0.0.0:* LISTEN 4221/haproxy tcp 0 0 0.0.0.0:8099 0.0.0.0:* LISTEN 4653/haproxy tcp 0 0 0.0.0.0:8099 0.0.0.0:* LISTEN 4221/haproxy tcp6 0 0 :::22 :::* LISTEN 855/sshd root@mylinux:~# service haproxy stop * Stopping haproxy haproxy [ OK ] root@mylinux:~# service haproxy status haproxy not running. root@mylinux:~# netstat -lntp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 4653/haproxy tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 4221/haproxy tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 956/nginx tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 855/sshd tcp 0 0 0.0.0.0:8090 0.0.0.0:* LISTEN 4653/haproxy tcp 0 0 0.0.0.0:8090 0.0.0.0:* LISTEN 4221/haproxy tcp 0 0 0.0.0.0:8099 0.0.0.0:* LISTEN 4653/haproxy tcp 0 0 0.0.0.0:8099 0.0.0.0:* LISTEN 4221/haproxy tcp6 0 0 :::22 :::* LISTEN 855/sshd root@mylinux:~# killall haproxy root@mylinux:~# netstat -lntp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 956/nginx tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 855/sshd tcp6 0 0 :::22 :::* LISTEN 855/sshd root@mylinux:~# service haproxy start * Starting haproxy haproxy [ OK ] root@mylinux:~# netstat -lntp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 8205/haproxy tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 956/nginx tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 855/sshd tcp 0 0 0.0.0.0:8090 0.0.0.0:* LISTEN 8205/haproxy tcp 0 0 0.0.0.0:8099 0.0.0.0:* LISTEN 8205/haproxy tcp6 0 0 :::22 :::* LISTEN 855/sshd root@mylinux:~# service haproxy restart * Restarting haproxy haproxy [ OK ] root@nzzad-lb01-test:~# netstat -lntp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 8286/haproxy tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 8205/haproxy tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 956/nginx tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 855/sshd tcp 0 0 0.0.0.0:8090 0.0.0.0:* LISTEN 8286/haproxy tcp 0 0 0.0.0.0:8090 0.0.0.0:* LISTEN 8205/haproxy tcp 0 0 0.0.0.0:8099 0.0.0.0:* LISTEN 8286/haproxy tcp 0 0 0.0.0.0:8099 0.0.0.0:* LISTEN 8205/haproxy tcp6 0 0 :::22 :::* LISTEN 855/sshd To manage notifications about this bug go to: https://bugs.launchpad.net/trusty-backports/+bug/1494141/+subscriptions _______________________________________________ Mailing list: https://launchpad.net/~ubuntu-ha Post to : ubuntu-ha@lists.launchpad.net Unsubscribe : https://launchpad.net/~ubuntu-ha More help : https://help.launchpad.net/ListHelp