Re: A note about SIGTERM illusion and reality - Mailing list pgsql-hackers

From Tom Lane
Subject Re: A note about SIGTERM illusion and reality
Date
Msg-id 21580.1200169712@sss.pgh.pa.us
Whole thread Raw
In response to A note about SIGTERM illusion and reality  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
I wrote:
> After digging in the man page for init(8) on a couple of machines,
> I realized that the SIGTERM-then-SIGKILL behavior only applies to
> processes that are launched directly by init.

Actually, after further experimentation, it seems this is very
platform-dependent.

Current Linux (tested on Fedora 8) actually does behave in the way
our code expects, ie, every process gets a SIGTERM.  The default
SIGTERM-to-SIGKILL delay is only 5 seconds, which is likely not enough
for a checkpoint in a busy database, but at least we tried :-(.

Mac OS X seems to issue everything SIGQUIT, instead of SIGTERM.
I didn't experiment to see how much grace period there might be.

No idea about other BSDen, though OS X's behavior might be typical.

HPUX seems to go straight to SIGKILL.

So the bottom line is that the best bet is to rely on an initscript's
stop command to issue "pg_ctl stop -m fast", which will give us enough
time to perform a clean shutdown.  The other behavior is only of
interest for databases that aren't controlled by an initscript known
to the system.  But there does seem to be some value in our designed
response to SIGTERM, on at least one popular platform, so I no longer
feel a need to rethink that.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Transaction Snapshot Cloning
Next
From: Tom Lane
Date:
Subject: Re: getting out boolean value from PQgetValue function