Re: segmentation fault when cassert enabled

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Jehan-Guillaume de Rorthais <jgdr(at)dalibo(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: segmentation fault when cassert enabled
Date: 2019-11-06 13:34:38
Message-ID: c75077cd-a1a7-9a2d-5dc6-4d3d8acfaafa@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2019-11-05 17:29, Jehan-Guillaume de Rorthais wrote:
> My best bet so far is that logicalrep_relmap_invalidate_cb is not called after
> the DDL on the subscriber so the relmap cache is not invalidated. So we end up
> with slot->tts_tupleDescriptor->natts superior than rel->remoterel->natts in
> slot_store_cstrings, leading to the overflow on attrmap and the sigsev.

It looks like something like that is happening. But it shouldn't.
Different table schemas on publisher and subscriber are well supported,
so this must be an edge case of some kind. Please continue investigating.

> By the way, I noticed attrmap is declared as AttrNumber * in struct
> LogicalRepRelMapEntry, AttrNumber being typedef'd as an int16. However, attrmap
> is allocated based on sizeof(int) in logicalrep_rel_open:
>
> entry->attrmap = palloc(desc->natts * sizeof(int));
>
> It doesn't look like a major problem, it just allocates more memory than
> needed.

Right. I have committed a fix for this.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2019-11-06 13:40:17 Re: TAP tests aren't using the magic words for Windows file access
Previous Message 曾文旌 (义从) 2019-11-06 13:24:36 Re: [Proposal] Global temporary tables