Re: Recovering from an exception - Mailing list pgsql-general

From Marko Tiikkaja
Subject Re: Recovering from an exception
Date
Msg-id op.wp9cc9qxye4vw9@blue.lan
Whole thread Raw
In response to Recovering from an exception  (Marko Tiikkaja <pgmail@joh.to>)
Responses Re: Recovering from an exception
List 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


pgsql-general by date:

Previous
From: Rafał Pietrak
Date:
Subject: Re: OLD pseudo relation for INSERT in rules and triggers
Next
From: "Marko Tiikkaja"
Date:
Subject: Re: Recovering from an exception