Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1viF96-001TCG-2g for pgsql-hackers@arkaria.postgresql.org; Tue, 20 Jan 2026 17:04:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1viF95-001xbM-36 for pgsql-hackers@arkaria.postgresql.org; Tue, 20 Jan 2026 17:04:00 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1viF95-001xb9-1f for pgsql-hackers@lists.postgresql.org; Tue, 20 Jan 2026 17:03:59 +0000 Received: from mail.postgrespro.ru ([93.174.132.70]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1viF93-001Yfs-0i for pgsql-hackers@postgresql.org; Tue, 20 Jan 2026 17:03:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1768928635; bh=Fd3oUKBKj8BecGhx+ghwJsh2EtEZ/HkHOG7xv0x3eGM=; h=Message-ID:Date:User-Agent:Subject:To:Cc:References:From: In-Reply-To:From; b=a1vIIYcdVsLMpNrEyzi/qu08U+CMekAEB4UGFaFogv5XphV06Lh2RHioqFFmv/Gug liul8D2UJnDZJTizdGbWRA4dCiupNGa0SI3pCtNQLMqc/pncpz66Nz7Ek0OVNyiVm8 z4ALIX881rU5HaV8V3d8sU2p5TC9SLTYtiZHUk4p44P8phvV4Pj/76+GTkcfcEIiOF xwJZyP4jhd0sjGQt2hu2WrQKbeoHfT/QA+N8n5tvgp5jUrXfRFDJDJzEN0QHw68mY0 gmaPqslTaMfQ8VXeRdDPA/IM5NMqBmBNaUdWThAJagOcARf91PtLyXnHga2xq68W++ tV2K0jBw8lxlg== Received: from [172.30.48.50] (debian11-template.l.postgrespro.ru [192.168.2.254]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: v.davydov@postgrespro.ru) by mail.postgrespro.ru (Postfix/465) with ESMTPSA id 7D9D960B00; Tue, 20 Jan 2026 20:03:55 +0300 (MSK) Message-ID: Date: Tue, 20 Jan 2026 20:03:55 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Exit walsender before confirming remote flush in logical replication To: Fujii Masao , Andrey Silitskiy Cc: "Hayato Kuroda (Fujitsu)" , "Takamichi Osumi (Fujitsu)" , "pgsql-hackers@postgresql.org" , "sawada.mshk@gmail.com" , "michael@paquier.xyz" , "peter.eisentraut@enterprisedb.com" , "dilipbalaut@gmail.com" , "andres@anarazel.de" , "amit.kapila16@gmail.com" , Kyotaro Horiguchi , Peter Smith , Greg Sabino Mullane , Alexander Korotkov References: <0fe5288d-5b4a-4aab-ae0e-c5a2fca0ee33@postgrespro.ru> <091704a7-dc44-45c2-874a-7eec7fba6071@postgrespro.ru> <3d024a19-1256-4177-942a-d7173dacba74@postgrespro.ru> Content-Language: en-US From: Vitaly Davydov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-KSMG-AntiPhishing: NotDetected, bases: 2026/01/20 16:31:00 X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.1.0.7854, bases: 2026/01/20 15:01:00 #28134254 X-KSMG-AntiVirus-Status: NotDetected, skipped X-KSMG-LinksScanning: not scanned, disabled by settings X-KSMG-Message-Action: skipped X-KSMG-Rule-ID: 1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Dear Hackers, I think, I reproduced test fails. The test fails because walsender is in waiting state in WalSndDoneImmediate -> ereport with the following stack (see below). It seems, it tries to send the message to the replica and flush it, but the replica is hung. #0 0x00007a4b37f2a037 in epoll_wait #1 0x000056855317a2e8 in WaitEventSetWaitBlock #2 WaitEventSetWait #3 0x0000568552feea8e in secure_write #4 0x0000568552ff5666 in internal_flush_buffer #5 0x0000568552ff5966 in internal_flush #6 socket_flush () #7 socket_flush () #8 0x00005685532ff1b3 in send_message_to_frontend (edata=) #9 EmitErrorReport () #10 0x00005685532ff6dd in errfinish #11 0x000056855312cc9c in WalSndDoneImmediate () at walsender.c:3625 I would propose to remove the ereport call from WalSndDoneImmediate. With best regards, Vitaly On 1/19/26 15:41, Fujii Masao wrote: > On Sun, Jan 18, 2026 at 1:20 AM Andrey Silitskiy > wrote: >> >> On Jan 9, 2026 at 10:04 AM Fujii Masao >> wrote: >>> Why do we need to send a "done" message to the receiver here? >>> Since delivery isn't guaranteed in immediate mode, it seems of limited >>> value. >> >> It seems to me that it is better to send a message in cases where it is >> possible, so as not to raise errors on the subscriber during a clean shutdown. >> And when this is not possible, exit the process without waiting. >> >>> For the immediate mode, would it make sense to log that the walsender is >>> terminating in immediate mode and that WAL replication may be incomplete, >>> so users can more easily understand what happened? >> >> Added to the latest patch. > > Thanks for updating the patch! > > cfbot is reporting a test failure. Could you please look into it and > fix the issue? > https://cirrus-ci.com/github/postgresql-cfbot/postgresql/cf%2F6234 > > Regards, >