Bug 65592

Summary: mpm_event does not create new child after MaxConnectionsPerChild is hit
Product: Apache httpd-2 Reporter: Matt Zuba <matt.zuba>
Component: mpm_eventAssignee: Apache HTTPD Bugs Mailing List <bugs>
Status: RESOLVED FIXED    
Severity: regression CC: alex2grad
Priority: P2 Keywords: FixedInTrunk, PatchAvailable
Version: 2.4.49   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Attachments: Correctly account processes

Description Matt Zuba 2021-09-22 15:38:06 UTC
I've encountered issues on multiple servers running Apache 2.4.49 where we have MaxConnectionsPerChild set for the event mpm.  When child processes die after this limit his hit, the mpm is not creating new processes which stop Apache from serving any requests.  This issue did not exist in 2.4.48.

The easiest way for me to reproduce with the most simplistic example is with the httpd docker images.  When modifying the mpm_event conf and setting all values to 1 (for ease of testing), 2.4.49 will cease to serve any requests, whereas 2.4.48 will continue to serve request after request.

=====================
<IfModule mpm_event_module>
    StartServers             1
    MinSpareThreads         1
    MaxSpareThreads        1
    ThreadsPerChild         1
    MaxRequestWorkers      1
    MaxConnectionsPerChild   1
</IfModule>
=====================

I can produce some repos with Dockerfiles in them if necessary.
Comment 1 Ruediger Pluem 2021-09-22 16:08:46 UTC
Created attachment 38046 [details]
Correctly account processes

Can you please try if the attached patch fixes your issue?
Comment 2 Matt Zuba 2021-09-22 17:51:29 UTC
Thank you for the quick patch.  I've applied it on top of the Apache source for Ubuntu from Ondřej Surý found at https://launchpad.net/~ondrej/+archive/ubuntu/apache2 and it has solved the problem in 2.4.49.
Comment 3 Ruediger Pluem 2021-09-22 18:51:25 UTC
Committed to trunk a r1893520.
Comment 4 Graham Leggett 2021-09-26 14:36:30 UTC
Backported to v2.4.50.
Comment 5 jerry 2021-09-27 02:35:16 UTC
(In reply to Matt Zuba from comment #2)
> Thank you for the quick patch.  I've applied it on top of the Apache source
> for Ubuntu from Ondřej Surý found at
> https://launchpad.net/~ondrej/+archive/ubuntu/apache2 and it has solved the
> problem in 2.4.49.

This sounds exactly like what I am experiencing with my recent upgrade to 2.4.49. I submitted my issue to the mailing list (https://httpd.markmail.org/search/?q=#query:+page:1+mid:mwn5orzpqoq4vwii+state:results).

May I ask how exactly you "applied the patch on top of the Apache source"?

Also, what are the chances of an immediate release with this patch given the significance of this issue in production servers?

Thanks!
Comment 6 jerry 2021-09-27 08:40:59 UTC
I found instructions to patch Apache here:
https://www.linuxquestions.org/questions/solaris-opensolaris-20/steps-to-apply-the-patch-apache-918907/#post4551988

Thanks for the patch!