On Friday, November 12, 2021 6:20 PM Ajin Cherian <itsa...@gmail.com> wrote:
> 
> Attaching version 39-
> 

Thanks for the new patch.

I met a problem when using "ALTER PUBLICATION ... SET TABLE ... WHERE ...", the
publisher was crashed after executing this statement.

Here is some information about this problem.

Steps to reproduce:
-- publisher
create table t(a int primary key, b int);
create publication pub for table t where (a>5);

-- subscriber
create table t(a int primary key, b int);
create subscription sub connection 'dbname=postgres port=5432' publication pub;

-- publisher
insert into t values (1, 2);
alter publication pub set table t where (a>7);


Publisher log:
2021-11-15 13:36:54.997 CST [3319891] LOG:  logical decoding found consistent 
point at 0/15208B8
2021-11-15 13:36:54.997 CST [3319891] DETAIL:  There are no running 
transactions.
2021-11-15 13:36:54.997 CST [3319891] STATEMENT:  START_REPLICATION SLOT "sub" 
LOGICAL 0/0 (proto_version '3', publication_names '"pub"')
double free or corruption (out)
2021-11-15 13:36:55.072 CST [3319746] LOG:  received fast shutdown request
2021-11-15 13:36:55.073 CST [3319746] LOG:  aborting any active transactions
2021-11-15 13:36:55.105 CST [3319746] LOG:  background worker "logical 
replication launcher" (PID 3319874) exited with exit code 1
2021-11-15 13:36:55.105 CST [3319869] LOG:  shutting down
2021-11-15 13:36:55.554 CST [3319746] LOG:  server process (PID 3319891) was 
terminated by signal 6: Aborted
2021-11-15 13:36:55.554 CST [3319746] DETAIL:  Failed process was running: 
START_REPLICATION SLOT "sub" LOGICAL 0/0 (proto_version '3', publication_names 
'"pub"')
2021-11-15 13:36:55.554 CST [3319746] LOG:  terminating any other active server 
processes


Backtrace is attached. I think maybe the problem is related to the below change 
in 0003 patch:

+                       free(entry->exprstate);

Regards
Tang
(gdb) bt
#0  0x00007f132335970f in raise () from /lib64/libc.so.6
#1  0x00007f1323343b25 in abort () from /lib64/libc.so.6
#2  0x00007f132339c897 in __libc_message () from /lib64/libc.so.6
#3  0x00007f13233a2fdc in malloc_printerr () from /lib64/libc.so.6
#4  0x00007f13233a4d80 in _int_free () from /lib64/libc.so.6
#5  0x00007f1317d4de6a in rel_sync_cache_relation_cb (arg=<optimized out>, 
relid=<optimized out>) at pgoutput.c:1884
#6  0x0000000000dd4191 in LocalExecuteInvalidationMessage 
(msg=msg@entry=0x2f6c7c8) at inval.c:653
#7  0x0000000000accfc2 in ReorderBufferExecuteInvalidations (nmsgs=4, 
msgs=0x2f6c7a8) at reorderbuffer.c:3261
#8  0x0000000000ad1f6f in ReorderBufferProcessTXN (rb=rb@entry=0x2f6c4a0, 
txn=0x2f8a478, commit_lsn=commit_lsn@entry=22148728, snapshot_now=<optimized 
out>,
    command_id=command_id@entry=0, streaming=streaming@entry=false) at 
reorderbuffer.c:2333
#9  0x0000000000ad35f6 in ReorderBufferReplay (txn=<optimized out>, 
rb=rb@entry=0x2f6c4a0, xid=xid@entry=713, commit_lsn=commit_lsn@entry=22148728,
    end_lsn=end_lsn@entry=22148912, 
commit_time=commit_time@entry=690256439713242, origin_id=0, origin_lsn=0) at 
reorderbuffer.c:2622
#10 0x0000000000ad4200 in ReorderBufferCommit (rb=0x2f6c4a0, xid=xid@entry=713, 
commit_lsn=22148728, end_lsn=22148912, 
commit_time=commit_time@entry=690256439713242,
    origin_id=origin_id@entry=0, origin_lsn=0) at reorderbuffer.c:2646
#11 0x0000000000ab1b59 in DecodeCommit (ctx=ctx@entry=0x2f6a490, 
buf=buf@entry=0x7ffd7dc0a6c0, parsed=parsed@entry=0x7ffd7dc0a550, 
xid=xid@entry=713,
    two_phase=<optimized out>) at decode.c:744
#12 0x0000000000ab20c3 in DecodeXactOp (ctx=ctx@entry=0x2f6a490, 
buf=buf@entry=0x7ffd7dc0a6c0) at decode.c:279
#13 0x0000000000ab3fd9 in LogicalDecodingProcessRecord (ctx=0x2f6a490, 
record=0x2f6a850) at decode.c:142
#14 0x0000000000b0d23d in XLogSendLogical () at walsender.c:2992
#15 0x0000000000b11ba3 in WalSndLoop (send_data=send_data@entry=0xb0d1d5 
<XLogSendLogical>) at walsender.c:2422
#16 0x0000000000b122a5 in StartLogicalReplication (cmd=cmd@entry=0x2f26e38) at 
walsender.c:1315
#17 0x0000000000b13b18 in exec_replication_command (
    cmd_string=cmd_string@entry=0x2e8f590 "START_REPLICATION SLOT \"sub\" 
LOGICAL 0/0 (proto_version '3', publication_names '\"pub\"')") at 
walsender.c:1762
#18 0x0000000000bbae43 in PostgresMain (dbname=<optimized out>, 
username=<optimized out>) at postgres.c:4493
#19 0x0000000000a84906 in BackendRun (port=port@entry=0x2eb5580) at 
postmaster.c:4584
#20 0x0000000000a8ae73 in BackendStartup (port=port@entry=0x2eb5580) at 
postmaster.c:4312
#21 0x0000000000a8b2b2 in ServerLoop () at postmaster.c:1801
#22 0x0000000000a8e010 in PostmasterMain (argc=argc@entry=3, 
argv=argv@entry=0x2e88b00) at postmaster.c:1473
#23 0x000000000091cb1a in main (argc=3, argv=0x2e88b00) at main.c:198

Reply via email to