Re: BUG #5906: assertion failure in AtCleanup_Portals - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #5906: assertion failure in AtCleanup_Portals
Date
Msg-id 9890.1299171337@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #5906: assertion failure in AtCleanup_Portals  (Itagaki Takahiro <itagaki.takahiro@gmail.com>)
Responses Re: BUG #5906: assertion failure in AtCleanup_Portals  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Itagaki Takahiro <itagaki.takahiro@gmail.com> writes:
> On Thu, Mar 3, 2011 at 09:14, YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp> wrote:
>> here's a small test case.

> I was able to reproduce the assertion failure.

> It looks we call CreatePortal for ROLLBACK, but don't invoke
> DropPortal nor AtAbort_Portals before AtCleanup_Portals.

Hmm.  The reason why not is that xact.c is already in TBLOCK_ABORT_END
state, ie, it knows it already did AbortTransaction and doesn't see a
need to do it again.  So the portal running ROLLBACK doesn't get
cleaned up by AtAbort_Portals.

We could revert the addition of the "cleanup == NULL" assert in
AtCleanup_Portals, but I'm still feeling that that assertion is a good
thing.  Maybe the cleanest fix is to have PortalRun do something to run
the cleanup hook where it does this:

                /* Prevent portal's commands from being re-executed */
                portal->status = PORTAL_DONE;

That should be a safe-enough place to run cleanup.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Dave Page
Date:
Subject: Re: BUG #5863: help message report 5433 as default port
Next
From: Ross Barrett
Date:
Subject: Re: BUG #5899: Memory corruption when running psql