Re: BUG #17054: Memory corruption in logical replication worker when replicating into partitioned table

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: sbernikov(at)gmail(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17054: Memory corruption in logical replication worker when replicating into partitioned table
Date: 2021-06-11 00:03:27
Message-ID: 1819098.1623369807@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> When logical replication target is a partitioned table then execution of any
> DDL on source table leads to crash of target (subscriber) server.

Thanks for the report! I duplicated the crash on v13 branch tip,
although it's hitting an assertion failure before reaching any segfault:

#2 0x00000000008f466a in ExceptionalCondition (
conditionName=conditionName(at)entry=0xa5eae0 "natts == rel->attrmap->maplen", errorType=errorType(at)entry=0x948cc9 "FailedAssertion",
fileName=fileName(at)entry=0xa52956 "worker.c",
lineNumber=lineNumber(at)entry=490) at assert.c:67
#3 0x0000000000777741 in slot_modify_cstrings (slot=slot(at)entry=0x2ec6e40,
srcslot=<optimized out>, rel=rel(at)entry=0x2eca918,
values=values(at)entry=0x7fffb3506480, replaces=replaces(at)entry=0x7fffb3509880)
at worker.c:490
#4 0x00000000007785e7 in apply_handle_tuple_routing (
edata=edata(at)entry=0x2ea45a0, remoteslot=remoteslot(at)entry=0x2ea48a0,
newtup=newtup(at)entry=0x7fffb3506480, operation=operation(at)entry=CMD_UPDATE)
at worker.c:1153
#5 0x0000000000778e74 in apply_handle_update (s=s(at)entry=0x7fffb3509fa0)
at worker.c:846
#6 0x000000000077963c in apply_dispatch (s=0x7fffb3509fa0) at worker.c:1415
#7 LogicalRepApplyLoop (last_received=254887792) at worker.c:1624
#8 ApplyWorkerMain (main_arg=<optimized out>) at worker.c:2171
#9 0x0000000000743ec9 in StartBackgroundWorker () at bgworker.c:890

Interestingly, the same test case does NOT crash for me on master.
So apparently we fixed something that should have been back-patched.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2021-06-11 00:17:21 Re: BUG #17055: Logical replication worker crashes when applying update of row that dose not exist in target partiti
Previous Message Tom Lane 2021-06-10 23:11:03 Re: BUG #17056: Segmentation fault on altering the type of the foreign table column with a default