Re: kevent latch paths don't handle postmaster death well

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: kevent latch paths don't handle postmaster death well
Date: 2020-10-14 19:36:37
Message-ID: CA+hUKGKvy_o=gXkbDEnpmJL-PcihAv272v-R+tpX3SdA+NdGVg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Oct 15, 2020 at 7:58 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> We appear to have already realized that the postmaster died, since we're
> inside proc_exit. WaitForBackgroundWorkerShutdown is doing this:
>
> rc = WaitLatch(MyLatch,
> WL_LATCH_SET | WL_POSTMASTER_DEATH, 0,
> WAIT_EVENT_BGWORKER_SHUTDOWN);
>
> which one would certainly hope would not block at all if the postmaster
> is already dead, yet it's doing so. I guess that the kevent stuff is
> failing to handle the case of another WaitLatch call after the postmaster
> is already known dead.

The process exit event is like an 'edge', not a 'level'... hmm. It
might be enough to set report_postmaster_not_running = true the first
time it tells us so if we try to wait again we'll treat it like a
level. I will look into it later today.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2020-10-14 19:39:00 jit and explain nontext
Previous Message Tom Lane 2020-10-14 19:14:58 Re: BUG #16663: DROP INDEX did not free up disk space: idle connection hold file marked as deleted