> On 12 Jun 2026, at 12:02, Andrey Borodin <[email protected]> wrote:
> 
> I hacked up a prototype (on top of
> your atomics commit) that maps the state portably on both sides


v2026-06-12 passed locally but tripped on the Windows CI (EXEC_BACKEND),
v2026-06-14 fixes that.

The mistake was handing ActiveInjectionPoints to children as the
postmaster's pointer through BackendParameters.  That only works for the
main shared memory segment, which is re-attached at a fixed address; the
file-backed array is mapped wherever each process lands, so the inherited
pointer was garbage and the first point hit in a child crashed.

v2026-06-14 drops that and lets each process map the file itself. Rather
than racing to map it at the right moment in child startup, the registry
is mapped lazily on first use: the first time a process checks a point it
attaches the file if it exists, and treats "no file" as "nothing armed".
So a point is reached even when it fires before the child has attached
shared memory - e.g. "backend-initialize", which 005_negotiate_encryption
exercises - and a point armed out of band, even before the server is up,
is not silently missed.  Forked children still just inherit the
postmaster's mapping.

Personally I do not like lazy initialization, it's race-prone. But it
guarantees the file is mapped before the first point is checked, wherever
that point sits.

The same revision also closes an unrelated init race: when two processes
create the backing file at once, the loser could map it before the winner
sized it (SIG-something on first touch). The attach path now waits for the
file to reach full size before mapping.

CI is green. Same two patches on top of your atomics commit. Let me know
if this prototype goes radically wrong way.

Thanks!


Best regards, Andrey Borodin.

Attachment: v2026-06-14-0001-injection_points-Switch-wait-wakeup-to-r.patch
Description: Binary data

Attachment: v2026-06-14-0003-injection_points-attach-and-coordinate-w.patch
Description: Binary data

Attachment: v2026-06-14-0002-injection_points-back-the-active-points-.patch
Description: Binary data

Reply via email to