Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected with -M #111

Closed
hakavlad opened this issue Feb 6, 2019 · 5 comments
Closed

Unexpected with -M #111

hakavlad opened this issue Feb 6, 2019 · 5 comments

Comments

@hakavlad
Copy link
Contributor

hakavlad commented Feb 6, 2019

sudo earlyoom -M 1
// I expect 1 KiB threshold
earlyoom v1.2-19-ga48e825
mem total: 13855 MiB, swap total:    0 MiB
Sending SIGTERM when mem <=  0 % and swap <= 10 %,
        SIGKILL when mem <=  0 % and swap <=  5 %
mem avail: 12488 of 13855 MiB (90 %), swap free:    0 of    0 MiB ( 0 %)
mem avail: 12480 of 13855 MiB (90 %), swap free:    0 of    0 MiB ( 0 %)
mem avail: 12481 of 13855 MiB (90 %), swap free:    0 of    0 MiB ( 0 %)
mem avail: 12480 of 13855 MiB (90 %), swap free:    0 of    0 MiB ( 0 %)
mem avail: 12480 of 13855 MiB (90 %), swap free:    0 of    0 MiB ( 0 %)
mem avail: 12481 of 13855 MiB (90 %), swap free:    0 of    0 MiB ( 0 %)
mem avail: 12481 of 13855 MiB (90 %), swap free:    0 of    0 MiB ( 0 %)
mem avail: 12480 of 13855 MiB (90 %), swap free:    0 of    0 MiB ( 0 %)
...
mem avail:  390 of 13855 MiB ( 2 %), swap free:    0 of    0 MiB ( 0 %)
mem avail:  307 of 13855 MiB ( 2 %), swap free:    0 of    0 MiB ( 0 %)
mem avail:  224 of 13855 MiB ( 1 %), swap free:    0 of    0 MiB ( 0 %)
mem avail:  141 of 13855 MiB ( 1 %), swap free:    0 of    0 MiB ( 0 %)
Low memory! At or below SIGKILL limits (mem: 0 %, swap: 5 %)
mem avail:  **132 of 13855 MiB ( 0 %)**, swap free:    0 of    0 MiB ( 0 %)
Killing process 'python3' with signal 9, pid: 3543, badness: 890, VmRSS: 12313 MiB
mem avail: 12471 of 13855 MiB (90 %), swap free:    0 of    0 MiB ( 0 %)
mem avail: 12465 of 13855 MiB (89 %), swap free:    0 of    0 MiB ( 0 %)
mem avail: 12465 of 13855 MiB (89 %), swap free:    0 of    0 MiB ( 0 %)
  • 132 MiB is 1%
  • 132 MiB is not 1 KiB (it was set via -M 1)

I expect termination at 1 KiB, not killing at 132 MiB.

@rfjakob
Copy link
Owner

rfjakob commented Feb 6, 2019

Well, all the thresholds have percent granularity, which is why you cannot have 1kib.

@hakavlad
Copy link
Contributor Author

hakavlad commented Feb 6, 2019

Can I set 1% for SIGTERM?

sudo earlyoom -m 1 -d
earlyoom v1.2-19-ga48e825
mem total: 13855 MiB, swap total:    0 MiB
Sending SIGTERM when mem <=  1 % and swap <= 10 %,
        SIGKILL when mem <=  0 % and swap <=  5 %
pid   383: badness   0 vm_rss   2372 systemd-udevd
    ^ new victim (higher vm_rss)
pid   774: badness   0 vm_rss    548 systemd-timesyn
pid   790: badness   0 vm_rss    956 iio-sensor-prox
...
adaptive sleep time: 100 ms
adaptive sleep time: 100 ms
mem avail:  279 of 13855 MiB ( 2 %), swap free:    0 of    0 MiB ( 0 %)
adaptive sleep time: 100 ms
adaptive sleep time: 100 ms
Low Memory! At or below SIGTERM limits (mem: 1 %, swap: 10 %)
mem avail:  **275** of 13855 MiB ( 1 %), swap free:    0 of    0 MiB ( 0 %)
pid   383: badness   0 vm_rss   2372 systemd-udevd
    ^ new victim (higher vm_rss)
pid   774: badness   0 vm_rss    548 systemd-timesyn
pid   790: badness   0 vm_rss    956 iio-sensor-prox
pid   791: badness   0 vm_rss    952 smartd
pid   793: badness   0 vm_rss   1648 ModemManager
pid   795: badness   0 vm_rss    404 avahi-daemon

mem avail: 275 of 13855 MiB ( 1 %)

275 is 2%, not 1%.

@hakavlad
Copy link
Contributor Author

hakavlad commented Feb 6, 2019

Well, all the thresholds have percent granularity, which is why you cannot have 1kib.

Seems like I can not set -m less than 1% or 2%. This should be documented.

@hakavlad
Copy link
Contributor Author

hakavlad commented Feb 27, 2019

you cannot have 1kib

I cannot have even 100 MiB. Also, I expected SIGTERM, but earlyoom sends SIGKILL.

$ earlyoom -r 0.001 -M 102400
earlyoom v1.2-34-g2391f96
mem total: 13855 MiB, swap total:    0 MiB
Sending SIGTERM when mem <=  0 % and swap <= 10 %,
        SIGKILL when mem <=  0 % and swap <=  5 %
Could not lock memory - continuing anyway: Cannot allocate memory
mem avail: 10212 of 13855 MiB (73 %), swap free:    0 of    0 MiB ( 0 %)
mem avail: 10211 of 13855 MiB (73 %), swap free:    0 of    0 MiB ( 0 %)
...
mem avail:  148 of 13855 MiB ( 1 %), swap free:    0 of    0 MiB ( 0 %)
mem avail:  140 of 13855 MiB ( 1 %), swap free:    0 of    0 MiB ( 0 %)
Low memory! At or below SIGKILL limits (mem: 0 %, swap: 5 %)
mem avail:  131 of 13855 MiB ( 0 %), swap free:    0 of    0 MiB ( 0 %)
Killing process 'python3' with signal 9, pid: 7981, badness: 725, VmRSS: 10031 MiB
mem avail: 2589 of 13855 MiB (18 %), swap free:    0 of    0 MiB ( 0 %)
mem avail: 10175 of 13855 MiB (73 %), swap free:    0 of    0 MiB ( 0 %)

@rfjakob
Copy link
Owner

rfjakob commented Mar 15, 2020

Fixed now. Granularity is virtually unlimited by using double floating point numbers.

@rfjakob rfjakob closed this as completed Mar 15, 2020
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 a pull request may close this issue.

2 participants