Bug 1432249

Summary: must fail startup with conflicting Listen directives
Product: Red Hat Software Collections Reporter: Hung <hpham>
Component: httpdAssignee: Luboš Uhliarik <luhliari>
Status: CLOSED ERRATA QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: urgent Docs Contact:
Priority: urgent    
Version: httpd24CC: jhouska, jorton, kanderso, luhliari
Target Milestone: rc   
Target Release: 2.4   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: httpd24-httpd-2.4.25-9.el7 httpd24-httpd-2.4.25-9.el6 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-04-26 10:25:06 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Hung 2017-03-14 21:59:50 UTC
Description of problem:
- httpd file descriptors for listening ports when reloading configuration twice is increasing 
- when httpd service reloading the same conf file with the listen directive, the httpd service should error out 

Version-Release number of selected component (if applicable):

# rpm -qa |grep httpd 
httpd24-apr-1.5.1-1.el6.x86_64
httpd24-httpd-2.4.18-11.el6.x86_64
httpd24-runtime-1.1-14.el6.x86_64
httpd24-apr-util-1.5.4-1.el6.x86_64
httpd24-libnghttp2-1.7.1-1.el6.x86_64
httpd24-httpd-tools-2.4.18-11.el6.x86_64


How reproducible:

1) Install httpd24-httpd package 
2) Create a ports.conf 

# cat  /opt/rh/httpd24/root/etc/httpd/conf.d/ports.conf 
Listen 127.0.0.1:82
Listen [::1]:82

3) Modify the "/opt/rh/httpd24/root/etc/httpd/conf/httpd.conf" to have the following Include directive:

#tail -n 3  /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf

Include "/opt/rh/httpd24/root/etc/httpd/conf.d/ports.conf"

4) Start the httpd24-httpd service  <-------In RHEL httpd prevent the httpd from starting  

5) Run lsof command > reload the httpd24-httpd service > lsof command again 

# lsof |grep httpd| grep LISTEN |wc -l 
42

# service httpd24-httpd reload

# lsof |grep httpd| grep LISTEN |wc -l 
54

Additional info:

When reproducing this in RHEL 6 httpd start/reload up will fail see the following:

# service httpd start
Starting httpd: (98)Address already in use: make_sock: could not bind to address 127.0.0.1:82
no listening sockets available, shutting down
Unable to open logs

Comment 1 Joe Orton 2017-03-15 09:30:54 UTC
Thanks for the report, it looks like this is a regression in upstream httpd 2.4.17 and later.  I've identified the fix.

http://svn.apache.org/viewvc?view=revision&revision=1777923

Comment 3 Joe Orton 2017-03-16 11:32:16 UTC
This issue was a regression with the addition of "listener buckets" in 2.4.17, which resulted in SO_REUSEPORT being enabled for all listening fds.  SO_REUSEPORT should only have been enabled if the ListenCoresBucketsRatio directive was used.  The fix is proposed for 2.4.26 and is a trivial backport.

Comment 13 errata-xmlrpc 2017-04-26 10:25:06 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://access.redhat.com/errata/RHSA-2017:1161