supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
* booting perpd with linux oom abatement
@ 2011-03-15 14:39 Wayne Marshall
  0 siblings, 0 replies; only message in thread
From: Wayne Marshall @ 2011-03-15 14:39 UTC (permalink / raw)
  To: supervision

In response to the announcement of the latest perp-2.03 release
on the supervision mailing list, there appeared some interesting
comments regarding the linux "oom killer" as colorfully
described here:

http://lwn.net/Articles/104179/

Evidently, the linux kernel can randomly terminate arbitrary
processes -- even privileged ones -- with SIGKILL.  Astonishing.

In any case, it would certainly be undesirable for the linux
kernel to decide to hit the perpd process with SIGKILL.
Accordingly, attached below is an alternative rc.perp boot
script that will abate the thread of the "dreaded linux oom
killer" on perpd(8).

Simply copy into /etc/perp/.boot/rc.perp, restart your system,
and worry no more.

<script>
#!/bin/sh -e
# rc.perp: perpd startup script for perpboot
# ===

### --- configure ---
PERP_VAR=/var/run/perp
PERPD_OPTS="-a6"

## disable oom killer (linux, since kernel 2.6.11):
## (see also proc(5) manual)
OOM_ADJ="-17"

### --- script ---
MYPID=$$

## note: perpboot defines PERP_BASE on startup
## note: perpd will create PERP_VAR if .control is a dangling
symlink

## setup symlink for runtime control files:
if test ! -h ${PERP_BASE}/.control ; then
  rm -Rf ${PERP_BASE}/.control
  ln -s ${PERP_VAR} ${PERP_BASE}/.control
fi

## disable oom killer (see proc(5), linux):
if test -w /proc/${MYPID}/oom_adj ; then
  echo ${OOM_ADJ} > /proc/${MYPID}/oom_adj
fi

## exec perpd, options as configured above:
exec \
  runlimit -F ./rlimit.conf \
  perpd ${PERPD_OPTS} ${PERP_BASE}

### EOF
</script>

I will also be happy to accept suggestions/contributions for a
new "runnoom(8)" utility to include with the runtools collection
in the next perp release.

Regards,

Wayne
http://b0llix.net/perp/


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-03-15 14:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-15 14:39 booting perpd with linux oom abatement Wayne Marshall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).