Skip to content

kill: implement an option for trigger kernel oom killer - #362

Closed
IceLocke wants to merge 5 commits into
rfjakob:masterfrom
IceLocke:master
Closed

kill: implement an option for trigger kernel oom killer#362
IceLocke wants to merge 5 commits into
rfjakob:masterfrom
IceLocke:master

Conversation

@IceLocke

@IceLocke IceLocke commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

As mentioned in issue #358 and README, after Linux 5.17, OOM sysrq will always kill a process.

This implements an option for trigger the kernel oom killer i.e. write an f to /proc/sysrq-trigger. Since the victim cannot be chosen by earlyoom, some of the features about customized victim selection won't take effect.

@hunshcn

hunshcn commented Feb 9, 2026

Copy link
Copy Markdown

@rfjakob PTAL

Comment thread kill.c Dismissed
Comment thread testsuite_unit_test.go Outdated
Comment on lines +416 to +418
// If running as root, should have permission and return 0
// If not root, should return -1 (permission denied)
if os.Getuid() == 0 {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check does not work in a container (and in github actions).

I suggest you do syscall.Access() from Go and check that the trigger_kernel_oom_killer() result matches what we expect acc. to the syscall.Acecss() result

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I have swithed to syscall.Access() and checked the result in CI

@rfjakob rfjakob left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small problem with the tests, otherwise nice

@IceLocke
IceLocke requested a review from rfjakob February 11, 2026 01:47
@rfjakob

rfjakob commented Feb 17, 2026

Copy link
Copy Markdown
Owner

Merged as 31707b9, thanks!

@rfjakob rfjakob closed this Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants