[Bug 1477221] [NEW] Init script fails to stop service
Ingo Dyck
bogus at bogushome.net
Wed Jul 22 16:31:38 UTC 2015
Public bug reported:
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 at 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 at ubuntu-1404:~# /etc/init.d/haproxy status
haproxy is running.
root at ubuntu-1404:~# cat /var/run/haproxy.pid
31802
root at 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 at 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 at ubuntu-1404:~#
root at 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 at ubuntu-1404:~# cat /var/run/haproxy.pid
cat: /var/run/haproxy.pid: No such file or directory
root at ubuntu-1404:~#
root at 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 at ubuntu-1404:~#
** Affects: haproxy (Ubuntu)
Importance: Undecided
Status: New
** Description changed:
+ 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
+ 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 at 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 at ubuntu-1404:~# /etc/init.d/haproxy status
haproxy is running.
- root at ubuntu-1404:~# cat /var/run/haproxy.pid
+ root at ubuntu-1404:~# cat /var/run/haproxy.pid
31802
root at 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 at 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 at ubuntu-1404:~#
+ root at ubuntu-1404:~#
root at 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 at ubuntu-1404:~# cat /var/run/haproxy.pid
+ root at ubuntu-1404:~# cat /var/run/haproxy.pid
cat: /var/run/haproxy.pid: No such file or directory
- root at ubuntu-1404:~#
+ root at ubuntu-1404:~#
root at 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 at ubuntu-1404:~#
--
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/1477221
Title:
Init script fails to stop service
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/haproxy/+bug/1477221/+subscriptions
More information about the Ubuntu-server-bugs
mailing list