Peter, you will not be able to reproduce on Debian unless you test
versions prior to Stable.

The reason why the stop script does not stop at all processes is because
it relied on the --pidfile option and this one only kills the first PID.
When nproc > 1, the PIDFILE contains all PIDs. This is why debian
introduced the use of --pid in a loop for all haproxy PIDs.

Now, 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.

This version is available in all Debian releases since Stable but only
available in Ubuntu Wily.  A fix for this situation is available for
haproxy 1.5 which is in trusty-backport (see LP: #1494141).  I will
backport that fix for the stable release and ask for an SRU on this one.

-- 
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/1481737

Title:
  HAProxy init script does not work correctly with nbproc configuration
  option

Status in haproxy package in Ubuntu:
  Confirmed

Bug description:
  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

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/haproxy/+bug/1481737/+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

Reply via email to