rfjakob / earlyoom

earlyoom - Early OOM Daemon for Linux

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What about SIGTERM?

hakavlad opened this issue · comments

2018 will end soon, but the signal is still not supported.

I expect the follow behavior by default: 10% - SIGTERM, 5% - SIGKILL.

Code like this

if mem < sigkill_level:
    send_signal_to_viсtim(9)
elif mem < sigterm_level:
    send_signal_to_victim(15)
else:
    sleep()

Do you know an app that does something useful on SIGTERM?

I didn't understand what you meant. I know that most of apps accept SIGTERM and terminate correctly.

The disadvantage is that SIGTERM can be ignored by apps. What is the advantage?

I guess the idea is that the app does something like "clean up before shutdown". However, how long does that take? Does it need additional memory to do so?

It happens quickly in most cases. Even it will need additional memory, process will killed at 5% (for example). Also, user will can set thresholds like that: 10% for SIGKILL and 0% for SIGTERM for ignore SIGTERM.
SIGTERM used by full-featured OOM preventer and no any problem happens.

The thing is, this is an extra option that the user may have to think about.

earlyoom only uses sigkill and works fine!

extra option that the user may have to think about

Should I stop offer any features more?

extra option that the user may have to think about

I think that users are not idiots.

Should I stop offer any features more?

No, don't stop! I like several of them.

I am going through old tickets, and read this #34 again.

Apparently postgresql does something useful on SIGTERM. I'll think again about this.