Page MenuHomeFreeBSD

rc.subr: Make sure oomprotect protects existing children
ClosedPublic

Authored by 0mp on Jul 7 2022, 8:38 PM.
Tags
None
Referenced Files
F153679285: D35747.id107890.diff
Wed, Apr 22, 9:07 PM
Unknown Object (File)
Tue, Apr 21, 9:32 AM
Unknown Object (File)
Tue, Apr 21, 9:31 AM
Unknown Object (File)
Mon, Apr 20, 4:44 PM
Unknown Object (File)
Mon, Apr 20, 9:41 AM
Unknown Object (File)
Sun, Apr 19, 2:05 AM
Unknown Object (File)
Fri, Apr 17, 1:10 AM
Unknown Object (File)
Tue, Apr 14, 6:19 AM
Subscribers

Details

Summary

The rc(8) framework support protecting services from OOM killer.
The current implementation applies the protection after the service has
already started. This works fine if only the main process is to be
protected (*_oomprotect=yes). However, the current implementation fails
to protect existing children when children are also to be protected
(*_oomprotect=all). This patch fixes that.

Note: it is not easy to apply the protectoin earlier because we want to
support both the services which use the "command" variable and those
that use the "start_cmd" variable.

PR: 256148
Co-authored-by: Mike Walker <mike.walker@napkindrawing.com>
Tested by: Jamie Landeg-Jones <jamie@catflap.org>
Fixes: 3bead71e959d - Add a global option where we can protect
MFC after: 1 week

Test Plan

The tests are implemented here: https://reviews.freebsd.org/D35745

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

0mp requested review of this revision.Jul 7 2022, 8:38 PM
adrian added a subscriber: adrian.

hey nice catch!

This revision is now accepted and ready to land.Jul 7 2022, 9:36 PM

The change LGTM.
That said I would suggest committing this as submited by: Mike Walker, not as a co-authored as he did the heavy lifting in this change.