Re: pgsql: Add kqueue(2) support to the WaitEventSet API.

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>, Thomas Munro <tmunro(at)postgresql(dot)org>, pgsql-committers <pgsql-committers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgsql: Add kqueue(2) support to the WaitEventSet API.
Date: 2020-03-16 20:30:40
Message-ID: 20200316203040.GA4019@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On 2020-Mar-17, Thomas Munro wrote:

> Reproduced here. The problem seems to be that macOS's getppid()
> returns the debugger's PID, while the debugger is attached. This
> doesn't happen on FreeBSD (even though the debugger does internally
> become the parent, getppid() is careful to return the "real" parent
> PID so that user space doesn't notice this trickery; apparently Apple
> made a different choice).

Wow ... Yeah, that was a known problem with FreeBSD, see
https://postgr.es/m/1292851036-sup-5399@alvh.no-ip.org
Evidently FreeBSD must have fixed it, but macOS has not caught up with
that ...

> The getppid() check is there to close a vanishingly rare race
> condition: when creating a WaitEventSet, we ask the kernel to tell us
> when the postmaster exits, but there is a possibility that the
> postmaster has already exited; normally that causes an error with
> errno == ESRCH (no such PID, it's already gone), but another unrelated
> process might have started that has the same PID, so we check if our
> ppid has changed after a successful return code. That's not going to
> work under a debugger on this OS.

Irk.

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Thomas Munro 2020-03-16 21:21:29 Re: pgsql: Add kqueue(2) support to the WaitEventSet API.
Previous Message Thomas Munro 2020-03-16 20:11:22 Re: pgsql: Add kqueue(2) support to the WaitEventSet API.

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2020-03-16 21:04:05 Re: [PATCH] Use PKG_CHECK_MODULES to detect the libxml2 library
Previous Message Andres Freund 2020-03-16 20:13:15 Re: Berserk Autovacuum (let's save next Mandrill)