Mailing List Archive

[Bug 1470] New: adjust Linux out-of-memory killer to stop sshd being killed
https://bugzilla.mindrot.org/show_bug.cgi?id=1470

Summary: adjust Linux out-of-memory killer to stop sshd being
killed
Classification: Unclassified
Product: Portable OpenSSH
Version: 5.0p1
Platform: All
URL: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=34176
7
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P2
Component: sshd
AssignedTo: bitbucket@mindrot.org
ReportedBy: cjwatson@debian.org


Created an attachment (id=1507)
--> (http://bugzilla.mindrot.org/attachment.cgi?id=1507)
adjust Linux out-of-memory killer

In some out-of-memory situations, the Linux kernel will look for a
process to kill, employing some heuristics to try to guess what will
help. It doesn't always get this right and can occasionally end up
killing innocent bystanders (though as noted in the referenced bug log
it's possible to tweak this to be more accurate).

It is useful to instruct the OOM killer never to kill sshd, since
almost everyone wants it to keep on running so that they have a chance
of dealing with the problem remotely. Originally I implemented this in
an init script, by getting sshd's pid and writing to
/proc/$pid/oom_adj, but Vaclav Ovsik pointed out in
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=480020 that that ends
up immortalising child processes too.

The attached patch is based on Vaclav's, though I tidied it up and
moved chunks of it into openbsd-compat/port-linux. The use of an
environment variable for configuration is a bit odd. I didn't feel good
about introducing a port-specific configuration file key, and the
values you write into oom_adj have a pretty bizarre syntax (documented
in
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/filesystems/proc.txt;hb=HEAD)
which I think is unlikely to be portable to other systems. I'd
appreciate any better ideas here.

--
Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
_______________________________________________
openssh-bugs mailing list
openssh-bugs@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-bugs