pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: pg15.3: dereference null *plan in CachedPlanIsSimplyValid/plpgsql
Date: Thu, 20 Jul 2023 11:55:32 -0400
Message-ID: <584104.1689868532@sss.pgh.pa.us> (raw)
In-Reply-To: <ZLlV+STFz1l/WhAQ@telsasoft.com>
References: <ZLlV+STFz1l/WhAQ@telsasoft.com>

Justin Pryzby <pryzby@telsasoft.com> writes:
> A production instance crashed like so.

Oh, interesting.  Apparently we got past the "Has cache invalidation fired
on this plan?" check:

    if (!plansource->is_valid || plan != plansource->gplan || !plan->is_valid)
        return false;

because "plan" and "plansource->gplan" were *both* null, which is
a case the code wasn't expecting.  plansource.c seems to be paranoid
about gplan possibly being null everywhere else but here :-(

> Note that the prior query seems to have timed out in the same / similar plpgsql
> statement:

Hm.  Perhaps that helps explain how we got into this state.  It must
be some weird race condition, given the lack of prior reports.
Anyway, adding a check for plan not being null seems like the
obvious fix.

			regards, tom lane





view thread (2+ messages)

Message-ID: <584104.1689868532@sss.pgh.pa.us>
Permalink:  ../584104.1689868532@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/584104.1689868532@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pryzby@telsasoft.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: pg15.3: dereference null *plan in CachedPlanIsSimplyValid/plpgsql
  In-Reply-To: <584104.1689868532@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox