Hello Kuroda-san,
27.05.2026 08:43, Hayato Kuroda (Fujitsu) wrote:
Hi Alexander,
I applied your reproducer atop my HEAD (12d00048), but I could not reproduce.
...
The build can be done if I restore changes in src/meson.build, but I could not
reproduce the failure if I run 035_standby_logicaldecoding.pl. Am I missing
something?
I'm sorry, it looks like I had messed up with the patch. Please try the fixed
one.
It makes the unmodified 035_standby_logical_decoding.pl fail for me as below:
CPPFLAGS="-O0" ./configure -q --enable-debug --enable-tap-tests --enable-injection-points && make -s -j8 &&
PROVE_TESTS="t/035*" make -s check -C src/test/recovery/
...
# pg_recvlogical: error: could not send replication command "START_REPLICATION SLOT "drop_db_activeslot" LOGICAL
0/00000000 ("include-xids" '0', "skip-empty-xacts" '1')": server closed the connection unexpectedly
# This probably means the server terminated abnormally
# before or while processing the request.
# pg_recvlogical: error: disconnected
# '
# doesn't match '(?^:conflict with recovery)'
t/035_standby_logical_decoding.pl .. 87/? # Looks like you failed 1 test of 89.
t/035_standby_logical_decoding.pl .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/89 subtests
Best regards,
Alexander
diff --git a/src/backend/replication/logical/logical.c b/src/backend/replication/logical/logical.c
index b969caae72e..53eb0d711bc 100644
--- a/src/backend/replication/logical/logical.c
+++ b/src/backend/replication/logical/logical.c
@@ -600,6 +600,7 @@ CreateDecodingContext(XLogRecPtr start_lsn,
ctx->reorder->output_rewrites = ctx->options.receive_rewrites;
+pg_usleep(100000);
ereport(LogicalDecodingLogLevel(),
(errmsg("starting logical decoding for slot \"%s\"",
NameStr(slot->data.name)),
diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c
index 04aa770d981..687ac057afc 100644
--- a/src/backend/replication/walsender.c
+++ b/src/backend/replication/walsender.c
@@ -1501,6 +1501,7 @@ StartLogicalReplication(StartReplicationCmd *cmd)
ReplicationSlotAcquire(cmd->slotname, true, true);
+pg_usleep(500000);
/*
* Force a disconnect, so that the decoding code doesn't need to care
* about an eventual switch from running in recovery, to running in a
diff --git a/src/interfaces/libpq/fe-secure.c b/src/interfaces/libpq/fe-secure.c
index 31d5b48d3f9..c08c2987c46 100644
--- a/src/interfaces/libpq/fe-secure.c
+++ b/src/interfaces/libpq/fe-secure.c
@@ -200,6 +200,16 @@ pqsecure_raw_read(PGconn *conn, void *ptr, size_t len)
n = recv(conn->sock, ptr, len, 0);
+if (conn->replication && conn->replication[0])
+{
+int save_errno = SOCK_ERRNO;
+char hb[1024];
+hb[0] = 0;
+for (size_t i = 0; i < n && i < 256; i++) sprintf(hb + (i * 2), "%02x", ((char *)ptr)[i]);
+fprintf(stderr, "!!!pqsecure_raw_read| len=%zu n=%zd errno=%d buf=%s\n", len, n, (n < 0) ? save_errno : 0, hb);
+SOCK_ERRNO_SET(save_errno);
+}
+
if (n < 0)
{
result_errno = SOCK_ERRNO;