RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1947475 - httpd: improve OOM handling w/systemd
Summary: httpd: improve OOM handling w/systemd
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: httpd
Version: 9.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: beta
: ---
Assignee: Luboš Uhliarik
QA Contact: Branislav Náter
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-04-08 14:35 UTC by Joe Orton
Modified: 2021-12-07 22:00 UTC (History)
3 users (show)

Fixed In Version: httpd-2.4.48-10.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-12-07 21:57:54 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Joe Orton 2021-04-08 14:35:16 UTC
Description of problem:
At the moment the httpd service is terminated if a single child is killed by the OOM killer.

Version-Release number of selected component (if applicable):
httpd-2.4.46-9.fc33

How reproducible:
always

Steps to Reproduce:
1. trigger excess memory consumption in one child

Actual results:
httpd.service is terminated after the oom-killer kills the child with excess memory consumption

Apr 08 15:14:19 systemd[1]: Started The Apache HTTP Server.
Apr 08 15:15:27 systemd[1]: httpd.service: A process of this unit has been killed by the OOM killer.
Apr 08 15:15:35 systemd[1]: httpd.service: Failed with result 'oom-kill'.

Expected results:
httpd should continue operating even if the child is terminated

Additional info:
Setting OOMPolicy=continue in httpd.service to prevent this seems reasonable.

Comment 1 Pavel Raiskup 2021-04-08 15:19:30 UTC
Reproducible using mod_oom written by Joe, packaged here:
https://copr.fedorainfracloud.org/coprs/praiskup/mod_oom/

Comment 2 Joe Orton 2021-04-09 07:16:00 UTC
My hesitation about this is that when the child is killed by SIGKILL it is otherwise not obvious from the httpd logs that the OOM condition took out a process (and terminated a bunch of active threads).  Since the parent will terminate a child via SIGKILL internally, a SIGKILL-killed child is reaped via waitpid() is not logged as an abnormal condition.  It is possible we could tweak that logic but not sure.

The OOM condition is logged in the journal for the unit, so shows up in "systemctl status httpd" as well as in dmesg etc.

Apr 08 15:21:08 systemd[1]: httpd.service: A process of this unit has been killed by the OOM killer.
Apr 08 15:22:53 systemd[1]: httpd.service: A process of this unit has been killed by the OOM killer.

The question is: is it better for httpd to continue processing requests in other children in an OOM situation, or should it terminate?

I think that "continue" is better.  A vulnerability which triggers OOM is mitigated from a complete DoS to a partial one.  The case Pavel found in production was a intermittent OOM (once per week, for example) and again, it is better in that case for httpd to recover.  That OOM has occurred remains obvious from the system logs so should be picked up in monitoring, or, when investigating performance/reliability issues.


Note You need to log in before you can comment on or make changes to this bug.