Re: BUG #16129: Segfault in tts_virtual_materialize in logical replication worker

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
Cc: Ondřej Jirman <ienieghapheoghaiwida(at)xff(dot)cz>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16129: Segfault in tts_virtual_materialize in logical replication worker
Date: 2019-11-21 23:34:18
Message-ID: 13241.1574379258@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I wrote:
> Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com> writes:
>> FWIW my hunch is the bug is somewhere in this chunk of code from
>> apply_heap_update:
>> oldctx = MemoryContextSwitchTo(GetPerTupleMemoryContext(estate));
>> ExecCopySlot(remoteslot, localslot);
>> slot_modify_cstrings(remoteslot, rel, newtup.values, newtup.changed);
>> MemoryContextSwitchTo(oldctx);

> I imagine the only reason this code has gotten past the valgrind
> animals is that we're not testing cases where non-replaced columns
> in the subscriber table are of pass-by-ref types.

Actually, it doesn't appear to me that we're testing this with
any non-replaced columns at all. The test modifications in the
attached proposed patch add that. For me, the unpatched code
doesn't crash with this test, but the non-replaced column reads
back as empty which is certainly wrong. Valgrind would likely
complain too, but I didn't try it.

regards, tom lane

Attachment Content-Type Size
fix-bogus-slot-manipulation-in-logical-rep.patch text/x-diff 5.1 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message mayur 2019-11-21 23:35:09 Re: BUG #16130: planner does not pick unique btree index and goes for seq scan but unsafe hash index works.
Previous Message Tom Lane 2019-11-21 22:37:25 Re: BUG #16129: Segfault in tts_virtual_materialize in logical replication worker