[Bug 1494141] [NEW] HAProxy 1.5 init script does not terminate processes

Claudio Kuenzler 1494141 at bugs.launchpad.net
Thu Sep 10 06:25:48 UTC 2015


Public bug reported:

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 at 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 at mylinux:~# service haproxy stop
 * Stopping haproxy haproxy                                                                                   [ OK ]

root at mylinux:~# service haproxy status
haproxy not running.

root at 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 at mylinux:~# killall haproxy

root at 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 at mylinux:~# service haproxy start
 * Starting haproxy haproxy                                                                                   [ OK ]

root at 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 at mylinux:~# service haproxy restart
 * Restarting haproxy haproxy                                                                                 [ OK ]

root at 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

** Affects: haproxy (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: haproxy

** Description changed:

  On a new installation of Ubuntu 14.04.3 LTS I installed HAProxy 1.5 from
- trusty-backports.
+ 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, too, which uses the stop function).
  
  Only with a kill I was able to correctly terminate the HAProxy
  processes.
  
  The following output should show more clarity:
  
  root at 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        
- 
+ 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 at mylinux:~# service haproxy stop
-  * Stopping haproxy haproxy                                                                                   [ OK ] 
- 
+  * Stopping haproxy haproxy                                                                                   [ OK ]
  
  root at mylinux:~# service haproxy status
  haproxy not running.
  
+ root at 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 at mylinux:~# killall haproxy
  
  root at 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        
+ 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 at mylinux:~# killall haproxy
- 
+ root at mylinux:~# service haproxy start
+  * Starting haproxy haproxy                                                                                   [ OK ]
  
  root at 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        
+ 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 at mylinux:~# service haproxy start
-  * Starting haproxy haproxy                                                                                   [ OK ] 
- 
- 
- root at 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 at mylinux:~# service haproxy restart
-  * Restarting haproxy haproxy                                                                                 [ OK ] 
- 
+  * Restarting haproxy haproxy                                                                                 [ OK ]
  
  root at 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    
+ 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

** Description changed:

  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, too, which uses the stop function).
+ (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 at 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 at mylinux:~# service haproxy stop
   * Stopping haproxy haproxy                                                                                   [ OK ]
  
  root at mylinux:~# service haproxy status
  haproxy not running.
  
  root at 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 at mylinux:~# killall haproxy
  
  root at 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 at mylinux:~# service haproxy start
   * Starting haproxy haproxy                                                                                   [ OK ]
  
  root at 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 at mylinux:~# service haproxy restart
   * Restarting haproxy haproxy                                                                                 [ OK ]
  
  root at 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

-- 
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to haproxy in Ubuntu.
https://bugs.launchpad.net/bugs/1494141

Title:
  HAProxy 1.5 init script does not terminate processes

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/haproxy/+bug/1494141/+subscriptions



More information about the Ubuntu-server-bugs mailing list