Re: Logical replication launcher did not automatically restart when got SIGKILL - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: Logical replication launcher did not automatically restart when got SIGKILL
Date
Msg-id CAHGQGwEw00wMhgGppEZ1qy+2b3dy_4MioufvAoaC3h=_4rNfbg@mail.gmail.com
Whole thread Raw
In response to Re: Logical replication launcher did not automatically restart when got SIGKILL  (shveta malik <shveta.malik@gmail.com>)
Responses Re: Logical replication launcher did not automatically restart when got SIGKILL
Re: Logical replication launcher did not automatically restart when got SIGKILL
List pgsql-hackers
On Thu, Jul 24, 2025 at 6:46 PM shveta malik <shveta.malik@gmail.com> wrote:
> Sounds reasonable.
> Thinking out loud, when cleaning up after a backend or background
> worker crash, process_pm_child_exit() is invoked, which subsequently
> calls both CleanupBackend() and HandleChildCrash(). After the cleanup
> completes, process_pm_child_exit() calls PostmasterStateMachine() to
> move to the next state. As part of that, PostmasterStateMachine()
> invokes ResetBackgroundWorkerCrashTimes() (only in crash
> scenarios/FatalError), to reset a few things. Since it also resets
> rw_worker.bgw_notify_pid, it seems reasonable to reset the rw_pid as
> well there.

Thanks!
Attached is a patch that fixes the issue by resetting rw_pid in
ResetBackgroundWorkerCrashTimes().

We should probably add a regression test for this case,
but I'd prefer to commit the fix first and work on the test separately.
Andrey Rudometov proposed a test patch in thread [1],
which we might use as a starting point.

Regards,

[1] https://postgr.es/m/CAF6JsWiO=i24qYitWe6ns1sXqcL86rYxdyU+pNYk-WueKPSySg@mail.gmail.com

--
Fujii Masao

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Custom pgstat support performance regression for simple queries
Next
From: Noah Misch
Date:
Subject: Re: Test instability when pg_dump orders by OID