45e0d80606326c94a20b3f006ca90d40afdf3de0
The No Hang Daemon
Nohang is a highly flexible full-featured daemon for Linux that correctly prevents out of memory.
What is the problem?
OOM Killer doesn't prevent OOM.
Solution
Use of earlyoom or nohang, but nohang is more featured.
Demo
Features
- convenient configuration with a config file with well-commented parameters (38 parameters in config)
SIGKILLandSIGTERMas signals that can be sent to the victimzramsupport (mem_used_totalas trigger)- desktop notifications of attempts to prevent OOM
- low memory notifications
- black, white, prefer, avoid lists via regex
- possibility of restarting processes via command like
systemctl restart somethingif the process is selected as a victim - possibility of decrease
oom_score_adj - prevention of killing innocent victim via
oom_score_min,min_delay_after_sigtermandmin_delay_after_sigkillparameters - customizable intensity of monitoring
An exaple of stdout
2018-06-30 Sat 19:42:56
MemAvailable (0 MiB, 0.0 %) < mem_min_sigterm (470 MiB, 8.0 %)
SwapFree (457 MiB, 7.8 %) < swap_min_sigterm (470 MiB, 8.0 %)
Preventing OOM: trying to send the SIGTERM signal to tail,
Pid: 14884, Badness: 866, VmRSS: 5181 MiB, VmSwap: 4983 MiB
Success
Requirements
- Linux 3.14+
- Python 3.4+
Memory and CPU usage
- VmRSS is about 12 MiB
- CPU usage depends on the level of available memory
Download
git clone https://github.com/hakavlad/nohang.git
cd nohang
Installation and start for systemd users
sudo ./install.sh
Purge
sudo ./purge.sh
Command line options
./nohang --help
usage: nohang [-h] [-c CONFIG]
optional arguments:
-h, --help show this help message and exit
-c CONFIG, --config CONFIG
path to the config file, default values:
./nohang.conf, /etc/nohang/nohang.conf
How to configure nohang
Default path to config after installation is
/etc/nohang/nohang.conf
Read config and edit values before the start of the program. Execute sudo systemctl restart nohang for apply changes.
Feedback
Please, create issues.
Description
Languages
Python
96.4%
Makefile
3.1%
Shell
0.5%