Re: kill -KILL: What happens?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Fetter <david(at)fetter(dot)org>
Cc: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: kill -KILL: What happens?
Date: 2011-01-13 18:00:10
Message-ID: 19942.1294941610@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

David Fetter <david(at)fetter(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2011-01-13 18:07:56 Re: kill -KILL: What happens?
Previous Message Magnus Hagander 2011-01-13 17:54:06 Re: system views for walsender activity