Bug 1527295

Summary: httpd with worker/event mpm segfaults after multiple SIGUSR1
Product: Red Hat Enterprise Linux 7 Reporter: Masaki MAENO <maeno.masaki>
Component: httpdAssignee: Luboš Uhliarik <luhliari>
Status: CLOSED ERRATA QA Contact: Maryna Nalbandian <mnalband>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.4CC: bnater, jorton, luhliari, maeno.masaki, martin.monperrus, mosvald, msugaya
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: httpd-2.4.6-88.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-30 11:19:05 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:
Bug Depends On:    
Bug Blocks: 1477664, 1549616, 1562205, 1594286    

Description Masaki MAENO 2017-12-19 07:00:33 UTC
Description of problem:

Apache httpd in RHEL7 configured with worker/event mpm segfaults after receiving multiple SIGUSR1. 2.4.6-67.el7_4.6.x86_64 also has problems. 


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

* RHEL7 Latest 2.4.6-67.el7_4.6.x86_64

How reproducible:

Near 100% with worker or event

Steps to Reproduce:
  1. Install httpd
  2. Ensure using worker or event
     (E.g.: sed -i -e '/^Load/s/^/#/' -e '/#Load.*event/s/^#//' /etc/httpd/conf.modules.d/00-mpm.conf)
  3. systemctl restart httpd
  4. Repeat "# kill -USR1 `cat /var/run/httpd/httpd.pid`; kill -USR1 `cat /var/run/httpd/httpd.pid`"

Actual results:

 [Fri Dec 15 10:39:29.964033 2017] [mpm_worker:notice] [pid 20084:tid 
140575944685696] AH00297: SIGUSR1 received.  Doing graceful restart
 [Fri Dec 15 10:39:30.084318 2017] [core:notice] [pid 20084] AH00060: 
seg fault or similar nasty error detected in the parent process

Expected results:

 httpd shouldn't segfault. With prefork, it doesn't

Additional info:

 The problem (httpd with worker/event mpm segfaults after multiple successive graceful reloads) was fixed in 2.4.6-53.el7 (Development Version)

- Apache httpd with worker/event mpm segfaults after multiple 
  successive graceful reloads triggered by logrotate
      https://access.redhat.com/solutions/2626601

* Tue Mar 07 2017 Luboš Uhliarik <luhliari> - 2.4.6-53
- Resolves: #1376835 - httpd with worker/event mpm segfaults after multiple
  successive graceful reloads

httpd-2.4.6-mpm-segfault.patch
============
--- a/server/mpm/event/event.c
+++ a/server/mpm/event/event.c
@@ -2735,6 +2735,7 @@ static int event_run(apr_pool_t * _pconf, apr_pool_t * plog, server_rec * s)

     /* we've been told to restart */
     apr_signal(SIGHUP, SIG_IGN);
+    apr_signal(AP_SIG_GRACEFUL, SIG_IGN);
     if (one_process) {
         /* not worth thinking about */
============

httpd in RHEL7 configured with worker/event mpm segfaults after receiving
multiple SIGUSR1. (logrotate.conf example: size 1G and daily)
2.4.6-67.el7_4.6.x86_64 also has problems. 

I think that the aforementioned patch is not sufficient and need to add accurate exclusion control.

Comment 5 Masaki MAENO 2018-04-09 04:50:40 UTC
Please fix the segfaults ("Apache httpd in RHEL7 configured with worker/event mpm segfaults after receiving multiple SIGUSR1") .

Is the problem fixed in the future?

Comment 8 Joe Orton 2018-06-21 15:12:58 UTC
There are a couple of different cases here, and I want to be sure we are fixing exactly what is expected:

1. A segfault on repeated SIGUSR1 (with unchanged configuration), using the event MPM.

2. A segfault on repeated SIGUSR1 (with unchanged configuration), using the worker MPM.

3. A segfault on SIGUSR1 when with changed configuration to load or unload mod_logio.

Cases (1) and (3) should be fixed in the current httpd, httpd-2.4.6-80.el7.x86_64 or later.

Case (2) is unaddressed and will be fixed here.

If there is a different reproduction case which works with httpd-2.4.6-80.el7.x86_64 please let us know.

Comment 10 Masaki MAENO 2018-06-22 00:07:25 UTC
I hope that the Cases (1) (2) and (3) with httpd-2.4.6-80.el7.x86_64 will be fixed.
I don't know a different reproduction.

Comment 15 errata-xmlrpc 2018-10-30 11:19:05 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/RHBA-2018:3211

Comment 16 Luboš Uhliarik 2018-11-05 12:01:31 UTC
*** Bug 1622641 has been marked as a duplicate of this bug. ***

Comment 17 martin.monperrus 2020-09-14 06:15:20 UTC
For the record, I was hit by this crash on Apache/2.4.25 several times.
Current workaround: switch to mpm_event

Comment 18 martin.monperrus 2020-09-14 06:21:01 UTC
FTR: upstream issue may be 
"child exit segmentation fault after apache graceful" https://bz.apache.org/bugzilla/show_bug.cgi?id=55914