Jira Link: DB-22894
Description
SELECT pg_logical_emit_message(true, 'prefix', 'payload') crashes the YSQL backend
with an assertion failure, and the postmaster then hits a second assertion while
reaping the dead backend, so the whole PostgreSQL instance restarts rather than
just the one connection. The non-transactional form (transactional := false)
is unaffected.
Steps to reproduce
Start a cluster (debug build) and run, in ysqlsh:
SELECT pg_logical_emit_message(true, 'pgoutput', 'a transactional message');
The connection drops with server closed the connection unexpectedly, and the
postmaster restarts with database system was not properly shut down; automatic recovery in progress.
This is also reachable through the upstream logical replication test suite:
src/test/subscription/t/020_messages.pl fails at line 50 against a YugabyteDB
publisher for exactly this reason.
Backend assertion
TRAP: FailedAssertion("!TransactionIdIsValid(proc->xid)",
File: "src/postgres/src/backend/storage/ipc/procarray.c", Line: 728)
ExceptionalCondition
ProcArrayEndTransaction procarray.c:728
CommitTransaction xact.c:2555
CommitTransactionCommand xact.c:3489
finish_xact_command postgres.c:3266
exec_simple_query postgres.c:1626
yb_exec_simple_query_impl postgres.c:6237
...
STATEMENT: SELECT pg_logical_emit_message(true, 'pgoutput', 'a transactional message')
Followed, in the postmaster, by:
TRAP: FailedAssertion("!TransactionIdIsValid(ProcGlobal->xids[myoff])",
File: "src/postgres/src/backend/storage/ipc/procarray.c", Line: 629)
ExceptionalCondition
ProcArrayRemove
...
PostmasterMain
Jira Link: DB-22894
Description
SELECT pg_logical_emit_message(true, 'prefix', 'payload')crashes the YSQL backendwith an assertion failure, and the postmaster then hits a second assertion while
reaping the dead backend, so the whole PostgreSQL instance restarts rather than
just the one connection. The non-transactional form (
transactional := false)is unaffected.
Steps to reproduce
Start a cluster (debug build) and run, in
ysqlsh:The connection drops with
server closed the connection unexpectedly, and thepostmaster restarts with
database system was not properly shut down; automatic recovery in progress.This is also reachable through the upstream logical replication test suite:
src/test/subscription/t/020_messages.plfails at line 50 against a YugabyteDBpublisher for exactly this reason.
Backend assertion
Followed, in the postmaster, by: