Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id F084E1337BDE for ; Thu, 3 Mar 2011 12:55:51 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 36655-01 for ; Thu, 3 Mar 2011 16:55:44 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id E6E501337BB9 for ; Thu, 3 Mar 2011 12:55:43 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p23GtbX5009891; Thu, 3 Mar 2011 11:55:37 -0500 (EST) To: Itagaki Takahiro cc: YAMAMOTO Takashi , pgsql-bugs@postgresql.org Subject: Re: BUG #5906: assertion failure in AtCleanup_Portals In-reply-to: References: <16798.1299078556@sss.pgh.pa.us> <20110303001403.11CB319CEB6@mail.netbsd.org> Comments: In-reply-to Itagaki Takahiro message dated "Thu, 03 Mar 2011 22:02:46 +0900" Date: Thu, 03 Mar 2011 11:55:37 -0500 Message-ID: <9890.1299171337@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201103/51 X-Sequence-Number: 29561 Itagaki Takahiro writes: > On Thu, Mar 3, 2011 at 09:14, YAMAMOTO Takashi 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