Re: BUG #5269: postgres backend terminates with SIGSEGV

From: Justin Pitts <justinpitts(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgreSQL(dot)org
Subject: Re: BUG #5269: postgres backend terminates with SIGSEGV
Date: 2010-01-14 03:22:30
Message-ID: 1871DADD-ECC1-4115-B4CF-03005AAC7641@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Sorry for the delay.

I am attempting to construct a JDBC test case that reproduces the problem.

I have installed the patch and have not seen the crash since.

On Jan 13, 2010, at 11:58 AM, Tom Lane wrote:

> I wrote:
>> After puzzling over this for many hours, I have a theory that seems to
>> fit the facts.
>
> I think the attached patch will fix it for you --- please test.
>
> regards, tom lane
>
> Index: src/backend/utils/cache/plancache.c
> ===================================================================
> RCS file: /cvsroot/pgsql/src/backend/utils/cache/plancache.c,v
> retrieving revision 1.27.2.1
> diff -c -r1.27.2.1 plancache.c
> *** src/backend/utils/cache/plancache.c 14 Jul 2009 15:37:55 -0000 1.27.2.1
> --- src/backend/utils/cache/plancache.c 13 Jan 2010 16:46:07 -0000
> ***************
> *** 1050,1063 ****
> void
> ResetPlanCache(void)
> {
> ! ListCell *lc;
>
> ! foreach(lc, cached_plans_list)
> {
> ! CachedPlanSource *plansource = (CachedPlanSource *) lfirst(lc);
> CachedPlan *plan = plansource->plan;
>
> ! if (plan)
> ! plan->dead = true;
> }
> }
> --- 1050,1106 ----
> void
> ResetPlanCache(void)
> {
> ! ListCell *lc1;
>
> ! foreach(lc1, cached_plans_list)
> {
> ! CachedPlanSource *plansource = (CachedPlanSource *) lfirst(lc1);
> CachedPlan *plan = plansource->plan;
> + ListCell *lc2;
>
> ! /* No work if it's already invalidated */
> ! if (!plan || plan->dead)
> ! continue;
> !
> ! /*
> ! * We *must not* mark transaction control statements as dead,
> ! * particularly not ROLLBACK, because they may need to be executed in
> ! * aborted transactions when we can't revalidate them (cf bug #5269).
> ! * In general there is no point in invalidating utility statements
> ! * since they have no plans anyway. So mark it dead only if it
> ! * contains at least one non-utility statement.
> ! */
> ! if (plan->fully_planned)
> ! {
> ! /* Search statement list for non-utility statements */
> ! foreach(lc2, plan->stmt_list)
> ! {
> ! PlannedStmt *plannedstmt = (PlannedStmt *) lfirst(lc2);
> !
> ! Assert(!IsA(plannedstmt, Query));
> ! if (IsA(plannedstmt, PlannedStmt))
> ! {
> ! /* non-utility statement, so invalidate */
> ! plan->dead = true;
> ! break; /* out of stmt_list scan */
> ! }
> ! }
> ! }
> ! else
> ! {
> ! /* Search Query list for non-utility statements */
> ! foreach(lc2, plan->stmt_list)
> ! {
> ! Query *query = (Query *) lfirst(lc2);
> !
> ! Assert(IsA(query, Query));
> ! if (query->commandType != CMD_UTILITY)
> ! {
> ! /* non-utility statement, so invalidate */
> ! plan->dead = true;
> ! break; /* out of stmt_list scan */
> ! }
> ! }
> ! }
> }
> }

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2010-01-14 04:26:53 Re: BUG #5275: validate_exec in port/exec.c only reads u/g/o, not ACLs
Previous Message James Bellinger 2010-01-14 02:01:54 BUG #5276: pg_ctl reads data directory on -D instead of postgresql.conf directoryh