Public bug reported:
In case you have more than one process enabled in the haproxy config, the init
script fails to stop all of those processes.
So to clarify you need to have this in your haproxy.cfg:
"""
...
global
maxconn 32000
ulimit-n 65536
user haproxy
group haproxy
nbproc 2
...
"""
the problem is more visible if you set the nbproc to higher number.
service haproxy stop --> will only stop on of the haproxy processes.
The problem is so that start-stop-daemon can't handle pid files with multiple
lines. Only stopping the first one. HAProxy does write all the pids started by
itself into the pid file, so the problem is not in HAProxy, but in the
start-stop-daemon or more likely in the init scrip of haproxy.
One solution or workaround is to remove pidfile option of start-stop-daemon in
the init script, than it wil work as killall and will stop the haproxy
processes properly.
To proof you can try this sequence:
service haproxy start #if its not running
ps ax | grep haproxy | grep -v grep | wc -l #this should report 2
service haproxy restart
ps ax | grep haproxy | grep -v grep | wc -l #this will report 3
The workaround as a diff:
root@ubi1:/opt# diff /etc/init.d/haproxy /etc/init.d/haproxy.orig
62c62
< --retry 5 --exec $HAPROXY || ret=$?
---
> --retry 5 --pidfile $PIDFILE --exec $HAPROXY || ret=$?
extra infos:
root@ubi1:/opt# lsb_release -rd
Description: Ubuntu 14.04.3 LTS
Release: 14.04
root@ubi1:/opt# apt-cache policy haproxy
haproxy:
Installed: 1.4.24-2ubuntu0.2
Candidate: 1.4.24-2ubuntu0.2
Version table:
1.5.3-1~ubuntu14.04.1 0
100 http://us.archive.ubuntu.com/ubuntu/ trusty-backports/main amd64
Packages
*** 1.4.24-2ubuntu0.2 0
500 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64
Packages
100 /var/lib/dpkg/status
1.4.24-2 0
500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
** Affects: haproxy (Ubuntu)
Importance: Undecided
Status: New
** Tags: haproxy
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1481737
Title:
HAProxy init script is not working properly
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/haproxy/+bug/1481737/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs