Bug 1223069 - earlyoom 1.8-1.1 crashes if started with priority flag (-p)
Summary: earlyoom 1.8-1.1 crashes if started with priority flag (-p)
Status: RESOLVED FIXED
Alias: None
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Other (show other bugs)
Version: Current
Hardware: Other Other
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: David B
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-18 10:56 UTC by David B
Modified: 2024-05-17 13:32 UTC (History)
1 user (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David B 2024-04-18 10:56:56 UTC
OS: Tumbleweed 20240416
earlyoom version: 1.8-1.1

After updating today I noticed that earlyoom crashes:

> bal. 18 10:40:50 earlyoom[13343]: earlyoom 1.8
> bal. 18 10:40:50 earlyoom[13343]: Notifying through D-Bus
> bal. 18 10:40:50 earlyoom[13343]: Preferring to kill process names that match regex '(^|/)(java|Isolated Web Co|Web Content|WebExtensions|firefox|chrome|opera|falkon|ffmpeg|vlc|mpv|akregator|thumbnail.so)$'
> bal. 18 10:40:50 earlyoom[13343]: Will avoid killing process names that match regex '(^|/)(systemd|Xorg|X|Xwayland|xdm|sddm|kdm|gdm|lightdm|plasmashell|kwin_wayland|kwin_x11|ssh|yast|yast2|y2controlcenter|zypper|rpm|dnf)$'
> bal. 18 10:40:50 systemd[1]: Started Process Core Dump (PID 13344/UID 0).
> bal. 18 10:40:50 systemd-coredump[13345]: [🡕] Process 13343 (earlyoom) of user 61876 dumped core.
>                                         
>                                           Stack trace of thread 13343:
>                                           #0  0x00007f260bb07b5b setpriority (libc.so.6 + 0x107b5b)
>                                           #1  0x000055845a69a161 n/a (earlyoom + 0x3161)
>                                           #2  0x00007f260ba2a1f0 __libc_start_call_main (libc.so.6 + 0x2a1f0)
>                                           #3  0x00007f260ba2a2b9 __libc_start_main@@GLIBC_2.34 (libc.so.6 + 0x2a2b9)
>                                           #4  0x000055845a69a3b5 n/a (earlyoom + 0x33b5)
>                                           ELF object binary architecture: AMD x86-64
> bal. 18 10:40:50 systemd[1]: earlyoom.service: Main process exited, code=dumped, status=31/SYS
> bal. 18 10:40:50 systemd[1]: earlyoom.service: Failed with result 'core-dump'.


From the stack trace it has something to do with the setpriority function, earlyoom has a flag -p to increase it's priority, from the man page:

>    -p
>        Increase earlyoom’s priority: set niceness of earlyoom to -20 and oom_score_adj to -100.
>
>        When earlyoom is run through its default systemd service, the -p switch doesn’t work.  To achieve the same effect, enter the following three lines into sudo systemctl edit earlyoom:
>
>               [Service]
>               OOMScoreAdjust=-100
>               Nice=-20

My config in /etc/sysconfig/earlyoom had -p:

> EARLYOOM_ARGS="-r 0 -M 524288 -s 10 -n -p --avoid '(^|/)(systemd|Xorg|X|Xwayland|xdm|sddm|kdm|gdm|lightdm|plasmashell|kwin_wayland|kwin_x11|ssh|yast|yast2|y2controlcenter|zypper|rpm|dnf)$' --prefer '(^|/)(java|Isolated\ Web\ Co|Web\ Content|WebExtensions|firefox|chrome|opera|falkon|ffmpeg|vlc|mpv|akregator|thumbnail.so)$'"

After removing the -p flag the service starts and since the systemd service config already contains the niceness and OOM score adjustments I guess this flag isn't really needed.
Comment 1 David B 2024-04-18 15:19:31 UTC
I've found that the combination of the -p flag and SystemCallFilter=~@resources @privileged in the systemd service config causes this crash.
Comment 2 David B 2024-04-18 15:44:50 UTC
Seems like an upstream issue, maybe they'll accept my pull request https://github.com/rfjakob/earlyoom/pull/313
Comment 3 Chenzi Cao 2024-05-17 07:12:38 UTC
Hi David, I assign it to you, please feel free to reassign whenever necessary, thanks!
Comment 4 David B 2024-05-17 13:32:08 UTC
Fixed in 1.8.2 - already in Tumbleweed.