Re: How to shoot yourself in the foot: kill -9 postmaster

From: Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: How to shoot yourself in the foot: kill -9 postmaster
Date: 2001-03-06 02:11:38
Message-ID: 3AA4475A.B55ADC7E@wgcr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
>
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > killproc should send a kill -15 to the process, wait a few seconds for
> > it to exit. If it does not, try kill -1, and if that doesn't kill it,
> > then kill -9.
>
> Tell it to the Linux people ... this is their boot-script code we're
> talking about.

RedHat, in particular. I can't vouch for any others.

On my RH 6.2 box, with initscripts-5.00-1 loaded, here's what killproc
does if no killlevel is set (even though a default $killlevel is set to
-9, it's not used in this code):
($pid is the pid of the proc to kill, $base is the name of the proc,
etc)

if [ "$notset" = "1" ] ; then
if ps h $pid>/dev/null 2>&1; then
# TERM first, then KILL if not dead
kill -TERM $pid
usleep 100000
if ps h $pid >/dev/null 2>&1 ; then
sleep 1
if ps h $pid >/dev/null 2>&1 ; then
sleep 3
if ps h $pid >/dev/null 2>&1 ; then
kill -KILL $pid
fi
fi
fi
fi
ps h $pid >/dev/null 2>&1
RC=$?
[ $RC -eq 0 ] && failure "$base shutdown" || success "$base
shutdown"
RC=$((! $RC))
# use specified level only
else
if ps h $pid >/dev/null 2>&1; then
kill $killlevel $pid
RC=$?
[ $RC -eq 0 ] && success "$base $killlevel" || failure "$base
$killlevel"
fi
fi

Is 6.1 this different from 6.2? This code on the surface seems
reasonable to me -- am I missing something? The 6.2 code (found in
/etc/rc.d/init.d/functions, for those who might not know where to find
killproc) sets a default killlevel but never uses it -- ignorant but not
stupid.
--
Lamar Owen
WGCR Internet Radio
1 Peter 4:11

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2001-03-06 02:14:16 Re: How to shoot yourself in the foot: kill -9 postmaster
Previous Message Philip Warner 2001-03-06 02:08:14 Re: pg_restore -U