Re: bug in SignalSomeChildren

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: bug in SignalSomeChildren
Date: 2010-12-20 19:20:03
Message-ID: AANLkTikOf9iTWGRqbzmgVJ0yV6hxqy87Pkqa3vKPpS1c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Dec 20, 2010 at 2:07 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> On Mon, Dec 20, 2010 at 1:26 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>>>> Can we add a develop option to force use of the kill(0) method?
>
>>> How will that avoid needing to have an honest answer from getppid()?
>>> Without that you can't know what to issue kill() against.
>
>> The answer to this question will probably be entirely self-evident if
>> you stare at PostmasterIsAlive() for, well, it took me about 10
>> seconds.  So probably less than five for you.
>
> Hmm, I was thinking that PostmasterPid was set originally from getppid,
> but it looks like we rely on inheriting it through fork instead.
> So maybe this will work.  It's still slower and less reliable than the
> getppid case for normal use, though.

Well, that's why it'd be a developer option, rather than the default
behavior. If we can agree on a name I'll work up a patch.
Bikeshedding in 3... 2... 1...

check_postmaster_via_kill
avoid_backend_getppid
...?

Another option that might be workable (but I have reservations, and
haven't tested it either) is to check whether the return value of
getppid() is equal to 1. If it's neither 1 nor PostmasterPid then try
kill().

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-12-20 19:23:22 Re: bug in SignalSomeChildren
Previous Message Tom Lane 2010-12-20 19:10:39 Re: Extensions, patch v20 (bitrot fixes)