Bug 1396219

Summary: Haproxy systemd wrapper reports wrong exit codes to systemd
Product: Red Hat Enterprise Linux 7 Reporter: Tom Lavigne <tlavigne>
Component: haproxyAssignee: Ryan O'Hara <rohara>
Status: CLOSED ERRATA QA Contact: Udi Shkalim <ushkalim>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 7.0CC: bperkins, cfeist, fdinitto, gcerami, lkimlick, michele, rohara, ushkalim, vcojot
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: haproxy-1.5.18-3.el7_3.1 Doc Type: If docs needed, set a value
Doc Text:
Previously, the haproxy-systemd-wrapper reported an incorrect exit status when the haproxy server failed to start. For example, when the haproxy server attempted to bind a port that was already in use, the haproxy-systemd-wrapper incorrectly returned a zero exit status, indicating success. This bug has been fixed, and haproxy-systemd-wrapper now correctly reports an error when the haproxy server fails to start.
Story Points: ---
Clone Of: 1391990 Environment:
Last Closed: 2016-12-08 17:16:35 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1391990, 1500968, 1500969, 1501527    
Bug Blocks:    

Description Tom Lavigne 2016-11-17 18:10:11 UTC
This bug has been copied from bug #1391990 and has been proposed
to be backported to 7.3 z-stream (EUS).

Comment 4 Udi Shkalim 2016-11-21 17:19:11 UTC
Verified on haproxy-1.5.18-3.el7_3.1.x86_64


Before:
[root@controller-1 ~]# nc -l 80 &
[root@controller-1 ~]# /usr/sbin/haproxy-systemd-wrapper -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid
<7>haproxy-systemd-wrapper: executing /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -Ds 
[ALERT] 325/170731 (19855) : Starting proxy horizon: cannot bind socket [10.0.0.101:80]
[ALERT] 325/170731 (19855) : Starting proxy horizon: cannot bind socket [172.17.1.11:80]
<5>haproxy-systemd-wrapper: exit, haproxy RC=256
[root@controller-1 ~]# echo $?
0

After the fix:
[root@controller-1 ~]# /usr/sbin/haproxy-systemd-wrapper -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid
<7>haproxy-systemd-wrapper: executing /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -Ds 
[ALERT] 325/171629 (20239) : Starting proxy horizon: cannot bind socket [10.0.0.101:80]
[ALERT] 325/171629 (20239) : Starting proxy horizon: cannot bind socket [172.17.1.11:80]
<5>haproxy-systemd-wrapper: exit, haproxy RC=1
[root@controller-1 ~]# echo $?
1

Comment 6 errata-xmlrpc 2016-12-08 17:16:35 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2931.html