From: Nathan Bossart <nathandbossart@gmail.com>
To: pgsql-hackers@postgresql.org
Cc: alvherre@kurilemu.de
Subject: REPACK decoding worker startup/teardown differs from parallel.c
Date: Thu, 27 Aug 2026 11:43:37 -0500
Message-ID: <apBpOVZOyqrakEr_@nathan> (raw)
I don't know for sure whether either of these are v19 material, but they
seemed important to at least note:
The startup wait only checks shared->initialized, and the error queue is
attached with a NULL BackgroundWorkerHandle, so a worker that dies before
it attaches leaves the leader waiting indefinitely, holding
ShareUpdateExclusive. Mihail brought this up in February [0], but it
doesn't seem to have been addressed. parallel.c attaches the same way, but
then calls shm_mq_set_handle() once the worker is registered, so the queue
knows which process it's waiting on and can tell us when that process is
gone. IIUC this issue can only happen when fork() fails.
For teardown, we wait for the worker to exit under HOLD_INTERRUPTS and only
then detach the error queue. A worker blocked writing into a full queue
waits for the leader to read from it, while the leader is waiting for the
worker to exit, so nobody moves. DestroyParallelContext() detaches first
to avoid this. I'm not sure if this is reachable in practice.
[0] https://postgr.es/m/CADzfLwXJLypkRdpwapQr%2BpZQnv1-NvkJ9DpzWhNwudQgirCE0Q%40mail.gmail.com
--
nathan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: nathandbossart@gmail.com, alvherre@kurilemu.de
Subject: Re: REPACK decoding worker startup/teardown differs from parallel.c
In-Reply-To: <apBpOVZOyqrakEr_@nathan>
References: <apBpOVZOyqrakEr_@nathan>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox