Go to file
2018-07-06 02:48:03 +09:00
.gitignore add support white, black, avoid, prefer lists 2018-06-23 15:39:17 +09:00
install.sh support logging to separate file and support low memory warnings 2018-07-03 00:08:02 +09:00
LICENSE 1 2018-06-08 17:08:16 +09:00
nohang support EXECUTE THE COMMAND INSTEAD OF SENDING THE SIGTERM SIGNAL 2018-07-04 04:10:23 +09:00
nohang.1 множество улучшений 2018-06-11 04:52:39 +09:00
nohang.conf fix conf defaults 2018-07-06 00:16:53 +09:00
nohang.logrotate support logging to separate file and support low memory warnings 2018-07-03 00:08:02 +09:00
nohang.service support logging to separate file and support low memory warnings 2018-07-03 00:08:02 +09:00
purge.sh support logging to separate file and support low memory warnings 2018-07-03 00:08:02 +09:00
README.md update readme 2018-07-06 02:48:03 +09:00

The No Hang Daemon

Nohang is a highly flexible full-featured daemon for Linux which is able to correctly prevent out of memory conditions.

What is the problem?

OOM killer doesn't prevent OOM conditions.

Solution

Use of earlyoom or nohang, but nohang is more featured.

Demo

Video: nohang prevents OOM after command while true; do tail /dev/zero; done has been executed.

Features

  • convenient configuration with a config file with well-commented parameters (38 parameters in config)
  • SIGKILL and SIGTERM as signals that can be sent to the victim
  • zram support (mem_used_total as 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 something if 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_sigterm and min_delay_after_sigkill parameters
  • 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. The config is well commented. Read config and edit values before the start of the program. Execute sudo systemctl restart nohang for apply changes.

Feedback

Please, create issues.