Re: Recovering from an exception

From: "Marko Tiikkaja" <pgmail(at)joh(dot)to>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Recovering from an exception
Date: 2013-01-02 00:16:11
Message-ID: op.wp9cc9qxye4vw9@blue.lan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

On Tue, 01 Jan 2013 15:56:50 +0100, I wrote:
> It looks like fcinfo (amongst other things) is allocated in a child of
> the SPI context. My speculation is that the SPI context gets reset by
> AtEOSubXact_SPI(), thus resetting the memory fcinfo points to, leading
> to SIGSEGV.

Indeed, that looks to be the case. If I change the bottom part of
AtEOSubXact_SPI() a bit:

- if (_SPI_current && !isCommit)
+ if (_SPI_current && _SPI_current->connectSubid == mySubid &&
!isCommit)

the problem goes away.

I'm puzzled as to why AtEOSubXact_SPI() needs to unconditionally clear the
surround SPI context, or why it assumes it's a good idea.

Regards,
Marko Tiikkaja

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marko Tiikkaja 2013-01-02 01:17:57 Re: Recovering from an exception
Previous Message Rafał Pietrak 2013-01-01 21:16:49 Re: OLD pseudo relation for INSERT in rules and triggers