Skip site navigation (1) Skip section navigation (2)

Re: exec_execute_message crash

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tatsuo Ishii <ishii(at)postgresql(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: exec_execute_message crash
Date: 2009-12-30 16:51:10
Message-ID: 27108.1262191870@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
Tatsuo Ishii <ishii(at)postgresql(dot)org> writes:
> parse causes transaction to abort, which causes call to
> AbortCurrentTransaction->AbortTransaction->AtAbort_portals->ReleaseCachedPlan. It
> calls ReleaseCachePlan(portal->cplan). ReleaseCachePlan calls
> MemoryContextDelete(plan->context) which destroys both portal->cplan
> and portal->stmts.

> That was the reason why I had segfault by accessing portal->stmts.

> To fix this I think exec_execute_message should throw an error if
> portal->cleanup is NULL, since portal->cleanup is NULLed by
> AtAbort_Portals at transaction abort (or portal is dropped).

This is just a kluge, and a rather bad one I think.  The real problem
here is that AtAbort_Portals destroys the portal contents and doesn't
do anything to record the fact.  It should probably be putting the
portal into PORTAL_FAILED state, and what exec_execute_message ought
to be doing is checking for that.  It might be a good idea to explicitly
zero out the now-dangling pointers in the Portal struct, too.

It'd be nice to have a test case for this, hint hint ...

			regards, tom lane

In response to

Responses

pgsql-hackers by date

Next:From: Robert HaasDate: 2009-12-30 16:56:17
Subject: Re: KNNGiST for knn-search (WIP)
Previous:From: Hiroshi SaitoDate: 2009-12-30 16:47:52
Subject: Re: test/example does not support win32.

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group