Init script fails to stop service

Bug #1477221 reported by Ingo Dyck
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
haproxy (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Init script fails to stop service

[Environment]

Trusty 14.04.2

[Description]

This seems to have been introduced in 1.4.24-2ubuntu0.1 as part of https://bugs.launchpad.net/ubuntu/+source/haproxy/+bug/1462495.

The problem as far as I can see it is that Trustys start-stop-daemon version doesn't handle --pid as expected by the init script. It only knows --pidfile.

        for pid in $(cat $PIDFILE); do
                start-stop-daemon --quiet --oknodo --stop \
                        --retry 5 --pid $pid --exec $HAPROXY || ret=$?
        done

start-stop-daemon treats the argument to --pid as a PID file and therefore tries to open it, which fails.

Debugging output:
root@ubuntu-1404:~# ps -ef | grep haproxy | grep -v grep
haproxy 31802 1 0 16:25 ? 00:00:00 /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -D -p /var/run/haproxy.pid
root@ubuntu-1404:~# /etc/init.d/haproxy status
haproxy is running.
root@ubuntu-1404:~# cat /var/run/haproxy.pid
31802
root@ubuntu-1404:~# bash -x /etc/init.d/haproxy stop
...
++ cat /var/run/haproxy.pid
+ for pid in '$(cat $PIDFILE)'
+ start-stop-daemon --quiet --oknodo --stop --retry 5 --pid 31802 --exec /usr/sbin/haproxy
+ '[' 0 -eq 0 ']'
+ rm -f /var/run/haproxy.pid
...
+ return 0
+ exit 0
root@ubuntu-1404:~# strace -f start-stop-daemon --quiet --oknodo --stop --retry 5 --pid 31802 --exec /usr/sbin/haproxy
....
open("31802", O_RDONLY) = -1 ENOENT (No such file or directory)
exit_group(0) = ?
+++ exited with 0 +++
root@ubuntu-1404:~#
root@ubuntu-1404:~# ps -ef | grep haproxy | grep -v grep
haproxy 31802 1 0 16:25 ? 00:00:00 /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -D -p /var/run/haproxy.pid
root@ubuntu-1404:~# cat /var/run/haproxy.pid
cat: /var/run/haproxy.pid: No such file or directory
root@ubuntu-1404:~#
root@ubuntu-1404:~# dpkg -l haproxy dpkg
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-======================================-========================-========================-==================================================================================
ii dpkg 1.17.5ubuntu5.4 amd64 Debian package management system
ii haproxy 1.4.24-2ubuntu0.1 amd64 fast and reliable load balancing reverse proxy
root@ubuntu-1404:~#

Ingo Dyck (bogus-i)
description: updated
Revision history for this message
Roger Lam (mrlamroger) wrote :

This is affecting us too. Moving from 1.4.24-2 to 1.4.24-2ubuntu0.1 broke our chef deploys. We restart haproxy at the end of our recipe and the old process doesn't get killed.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in haproxy (Ubuntu):
status: New → Confirmed
tags: added: canonical-bootstack
Revision history for this message
Ryan Harper (raharper) wrote :

If you're still having trouble with haproxy in trusty, please test out this version:

1.4.24-2ubuntu0.2

which contains a fix for this issue.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.