Re: [HACKERS] Weaker shmem interlock w/o postmaster.pid

From: Noah Misch <noah(at)leadboat(dot)com>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: Daniel Gustafsson <daniel(at)yesql(dot)se>, Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, "9erthalion6(at)gmail(dot)com" <9erthalion6(at)gmail(dot)com>, "sfrost(at)snowman(dot)net" <sfrost(at)snowman(dot)net>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] Weaker shmem interlock w/o postmaster.pid
Date: 2019-04-11 06:22:28
Message-ID: 20190411062228.GB2620174@rfd.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Apr 11, 2019 at 12:48:35PM +1200, Thomas Munro wrote:
> On Mon, Apr 8, 2019 at 6:42 PM Noah Misch <noah(at)leadboat(dot)com> wrote:
> > - AIX animals failed two ways. First, I missed a "use" statement such that
> > poll_start() would fail if it needed more than one attempt. Second, I
> > assumed $pid would be gone as soon as kill(9, $pid) returned[1].
>
> > [1] POSIX says "sig or at least one pending unblocked signal shall be
> > delivered to the sending thread before kill() returns." I doubt the
> > postmaster had another signal pending often enough to explain the failures, so
> > AIX probably doesn't follow POSIX in this respect.
>
> It looks like you fixed this, but I was curious about this obversation
> as someone interested in learning more about kernel stuff and
> portability... Maybe I misunderstood, but isn't POSIX referring to
> kill(sig, $YOUR_OWN_PID) there? That is, if you signal *yourself*,
> and no other thread exists that could handle the signal, it will be
> handled by the sending thread, and in the case of SIGKILL it will
> therefore never return. But here, you were talking about a perl
> script that kills the postmaster, no? If so, that passage doesn't
> seem to apply.

You're right. I revoke the footnote.

> In any case, regardless of whether the signal handler
> has run to completion when kill() returns, doesn't the pid have to
> continue to exist in the process table until it is reaped by its
> parent (possibly in response to SIGCHLD), with one of the wait*()
> family of system calls?

True. I'll add that to the code comment.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ideriha, Takeshi 2019-04-11 06:27:05 RE: Protect syscache from bloating with negative cache entries
Previous Message Andrey Lepikhov 2019-04-11 06:10:27 Re: Failure in contrib test _int on loach