Re: Exit walsender before confirming remote flush in logical replication
Andrey Silitskiy <a.silitskiy@postgrespro.ru>
From: Andrey Silitskiy <a.silitskiy@postgrespro.ru>
To: Alexander Korotkov <aekorotkov@gmail.com>,
Fujii Masao <masao.fujii@gmail.com>
Cc: Greg Sabino Mullane <htamfids@gmail.com>, Japin Li <japinli@hotmail.com>,
Ronan Dunklau <ronan@dunklau.fr>, Vitaly Davydov <v.davydov@postgrespro.ru>,
"Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>,
"Takamichi Osumi (Fujitsu)" <osumi.takamichi@fujitsu.com>,
"pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>,
"sawada.mshk@gmail.com" <sawada.mshk@gmail.com>,
"michael@paquier.xyz" <michael@paquier.xyz>,
"peter.eisentraut@enterprisedb.com" <peter.eisentraut@enterprisedb.com>,
"dilipbalaut@gmail.com" <dilipbalaut@gmail.com>,
"andres@anarazel.de" <andres@anarazel.de>,
"amit.kapila16@gmail.com" <amit.kapila16@gmail.com>,
Kyotaro Horiguchi <horikyota.ntt@gmail.com>,
Peter Smith <smithpb2250@gmail.com>
Date: 2026-03-30T03:14:15Z
Lists: pgsql-hackers
Attachments
- v6-0001-Introduce-a-new-wal_sender_shutdown_timeout-GUC.patch (text/x-patch) patch v6-0001
On Mar 29, 2026 Alexander Korotkov <aekorotkov(at)gmail(dot)com> wrote: > One possible idea why hand may happen for is is that > WalSndWaitForWal() has missing WalSndCheckShutdownTimeout() call. On Mar 25, 2026 Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote: > I tested wal_sender_shutdown_timeout under several configurations and > encountered a case where the primary shutdown got stuck, ... Thanks for your help in finding the issue! I reproduced the problem, in this configuration it turned out that the walsender was not terminated by wal_sender_shutdown_timeout in WalSndWaitForWal(), but only when the physical slot was checked for inactive flag, which caused shutdown to hang. Fix added to the latest patch. Added a perl test-case for this configuration. It is worth noting that in this configuration, the second walsender may terminate due to inactive slot before the wal_sender_shutdown_timeout terminates the process, so the test checks timeout termination of only one walsender. Regards, Andrey Silitskiy
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Avoid blocking indefinitely while finishing walsender shutdown
- c0b24b32b0d3 19 (unreleased) landed
-
Add wal_sender_shutdown_timeout GUC to limit shutdown wait for replication
- a8f45dee9176 19 (unreleased) landed
-
pg_upgrade: Add --copy option
- 746915c68669 16.0 cited
-
Prevent possibility of panics during shutdown checkpoint.
- c6c333436491 10.0 cited
-
Support clean switchover.
- 985bd7d49726 9.4.0 cited