Re: kill -KILL: What happens? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: kill -KILL: What happens?
Date
Msg-id 19942.1294941610@sss.pgh.pa.us
Whole thread Raw
In response to Re: kill -KILL: What happens?  (David Fetter <david@fetter.org>)
Responses Re: kill -KILL: What happens?  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Re: kill -KILL: What happens?  (Florian Pflug <fgp@phlo.org>)
List pgsql-hackers
David Fetter <david@fetter.org> writes:
> On Thu, Jan 13, 2011 at 10:41:28AM -0500, Tom Lane wrote:
>> It's just that you're then looking at having to manually clean up the
>> child processes and then restart the postmaster; a process that is not
>> only tedious but does offer the possibility of screwing yourself.

> Does this mean that there's no cross-platform way to ensure that
> killing a process results in its children's timely (i.e. before damage
> can occur) death?  That such a way isn't practical from a performance
> point of view?

The simple, easy, cross-platform solution is this: don't kill -9 the
postmaster.  Send it one of the provisioned shutdown signals and let it
kill its children for you.

At least on Unix I don't believe there is any other solution.  You
could try looking at ps output but there's a fundamental race condition,
ie the postmaster could spawn another child just before you kill it,
whereupon the child is reassigned to init and there's no longer a good
way to tell that it came from that postmaster.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: system views for walsender activity
Next
From: "Kevin Grittner"
Date:
Subject: Re: kill -KILL: What happens?