preoomkiller

Crates.iopreoomkiller
lib.rspreoomkiller
version0.1.0
sourcesrc
created_at2017-01-23 03:35:30.345571
updated_at2021-11-02 03:04:52.691353
descriptionSoftly kills your process with SIGTERM before it runs out of memory.
homepagehttps://github.com/grosser/preoomkiller
repository
max_upload_size
id8190
size14,522
release-team (github:redis-rs:release-team)

documentation

README

Softly kills your process with SIGTERM before it runs out of memory.

  • Made for processes that run inside docker.
  • defaults to /sys/fs/cgroup/memory/memory.usage_in_bytes and /sys/fs/cgroup/memory/memory.stat

Written in Rust to consume minimal resources.

Version: 0.1.0

Usage

Download the binary you need from target/your-arch or cargo install preoomkiller.

Usage: target/debug/preoomkiller [options] args

Options:
    -m, --max-memory-file PATH
                        set file to read maximum memory from, default:
                        /sys/fs/cgroup/memory/memory.stat
    -u, --used-memory-file PATH
                        set file to read used memory from, default:
                        /sys/fs/cgroup/memory/memory.usage_in_bytes
    -i, --interval SECONDS
                        how often to check memory usage, default: 1
    -p, --percent PERCENT
                        maximum memory usage percent, default: 90
    -h, --help          print this help menu
    -v, --version       show version

Build

Test

Tested with Ruby to have readable / expressive tests.

  • Build
  • gem install bundler ... needs ruby installed
  • bundle
  • bundle exec rake

Release

  • bundle exec rake bump:patch
  • bundle exec rake release

TODO

  • remove regex dependency by splitting string and searching manually
  • travis + show status on crates.io
  • kill child when process is killed (already has a failing test)
  • find safe way of doing wait / kill ... http://stackoverflow.com/questions/35093869
  • make rake bump release for multiple targets and commit all changes
  • add --signal option ... support numbers and ideally USR1 etc words
  • make percent a float
  • add --restart option to not kill but restart ... maybe don't since this is tricky / needs a limit
Commit count: 0

cargo fmt