Yeah I agree, service masking is a corner case and it's just making things more confusing. I also got misled by the haproxy_status function, which doesn't actually seem to ever be called (although I still think some return codes are wrong).
My bug report stemmed from seeing on a production server that Pacemaker was not be able to detect that haproxy was down. Since my initial analysis (RC=0 simply if PIDFILE exists) was wrong and I can't analyze the original issue any further, I think this report could be closed. On the other hand, what Karl found out is still valid: it is a corner case, but `test -x $HAPROXY || exit 0` isn't really correct. If the initscript is to be LSB compliant[0], RC=0 must be reserved for success. The fact that the binary isn't executable doesn't say anything about whether the process is running, and would make the start action fail. [if the initscript is not meant to be LSB compliant it should not be used as a Pacemaker RA, but that's a separate issue] [0] https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html -- 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/1810926 Title: initscript status check is too fragile Status in haproxy package in Ubuntu: Confirmed Bug description: `/etc/init.d/haproxy status` will return 0 if the pidfile is present, regardless of whether haproxy is actually running. I suggest for the check to be rewritten to actually look for a process with that PID (e.g. `pgrep -F $PIDFILE`). How to reproduce: chmod -x /usr/sbin/haproxy service haproxy restart Result: RC of `service haproxy status` is 3, but RC of `/etc/init.d/haproxy status` is 0 Impact: The initscript is used as a LSB RA for pacemaker deployments; this bug effectively prevents pacemaker from realizing that haproxy is down (in some cases). Tested on: root@juju-8d5e58-14:~# lsb_release -rd Description: Ubuntu 16.04.5 LTS Release: 16.04 root@juju-8d5e58-14:~# dpkg -s haproxy | grep Version Version: 1.6.3-1ubuntu0.1 This bug is present in the most recent debian package upstream as well (1.9.0-1), but I think it would make sense to track this here first as we have a lot of OpenStack installations on Xenial that would benefit from receiving a fix. To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/haproxy/+bug/1810926/+subscriptions _______________________________________________ Mailing list: https://launchpad.net/~ubuntu-ha Post to : [email protected] Unsubscribe : https://launchpad.net/~ubuntu-ha More help : https://help.launchpad.net/ListHelp

