Hello. While playing with logical publications/subscriptions I’ve noted that walsender crashes when i’m trying to CREATE SUBSCRIPTION to a current server.
So having one running postgres instance on a standard port:
stas=# CREATE SUBSCRIPTION mysub CONNECTION 'dbname=stas host=127.0.0.1'
PUBLICATION mypub;
^CCancel request sent
ERROR: canceling statement due to user request
stas=# CREATE SUBSCRIPTION mysub CONNECTION 'dbname=stas host=127.0.0.1'
PUBLICATION mypub;
WARNING: terminating connection because of crash of another server process
Crash happens due to uninitialised StringBuffer reply_message in walsender.c:
(lldb) bt
* thread #1: tid = 0x13e3f, 0x000000010e74ebaf
postgres`resetStringInfo(str=0x000000010ecd12a0) + 15 at stringinfo.c:96, queue
= 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
* frame #0: 0x000000010e74ebaf
postgres`resetStringInfo(str=0x000000010ecd12a0) + 15 at stringinfo.c:96
frame #1: 0x000000010e8778c9 postgres`ProcessRepliesIfAny + 169 at
walsender.c:1347
frame #2: 0x000000010e8770fd postgres`WalSndWaitForWal(loc=35929928) + 221
at walsender.c:1142
frame #3: 0x000000010e876cf2
postgres`logical_read_xlog_page(state=0x00007fbcac0446f8,
targetPagePtr=35921920, reqLen=8008, targetRecPtr=35929904, cur_page="\x95?",
pageTLI=0x00007fbcac044fa4) + 50 at walsender.c:717
frame #4: 0x000000010e571e5e
postgres`ReadPageInternal(state=0x00007fbcac0446f8, pageptr=35921920,
reqLen=8008) + 542 at xlogreader.c:556
frame #5: 0x000000010e571336
postgres`XLogReadRecord(state=0x00007fbcac0446f8, RecPtr=35929904,
errormsg=0x00007fff5178f1e0) + 326 at xlogreader.c:255
frame #6: 0x000000010e85ea9b
postgres`DecodingContextFindStartpoint(ctx=0x00007fbcac044438) + 139 at
logical.c:432
frame #7: 0x000000010e874dfd
postgres`CreateReplicationSlot(cmd=0x00007fbcad8004d0) + 333 at walsender.c:796
frame #8: 0x000000010e8747a4
postgres`exec_replication_command(cmd_string="CREATE_REPLICATION_SLOT \"mysub\"
LOGICAL pgoutput") + 532 at walsender.c:1272
frame #9: 0x000000010e8e6adc postgres`PostgresMain(argc=1,
argv=0x00007fbcad005f50, dbname="stas", username="stas") + 2332 at
postgres.c:4064
frame #10: 0x000000010e839abe postgres`BackendRun(port=0x00007fbcabc033a0)
+ 654 at postmaster.c:4310
frame #11: 0x000000010e838eb3
postgres`BackendStartup(port=0x00007fbcabc033a0) + 483 at postmaster.c:3982
frame #12: 0x000000010e837ea5 postgres`ServerLoop + 597 at postmaster.c:1722
frame #13: 0x000000010e8356b5 postgres`PostmasterMain(argc=3,
argv=0x00007fbcabc02b90) + 5397 at postmaster.c:1330
frame #14: 0x000000010e76371f postgres`main(argc=3,
argv=0x00007fbcabc02b90) + 751 at main.c:228
frame #15: 0x00007fffa951c255 libdyld.dylib`start + 1
frame #16: 0x00007fffa951c255 libdyld.dylib`start + 1
Patch with lacking initStringInfo() attached.
init_reply_message.diff
Description: Binary data
-- Stas Kelvich Postgres Professional: http://www.postgrespro.com The Russian Postgres Company
-- Sent via pgsql-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
