pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: exclusion@gmail.com
Cc: pgsql-bugs@lists.postgresql.org, Jeff Davis <pgsql@j-davis.com>
Subject: Re: BUG #16784: Server crash in ExecReScanAgg()
Date: Mon, 21 Dec 2020 14:26:06 -0500
Message-ID: <553495.1608578766@sss.pgh.pa.us> (raw)
In-Reply-To: <16784-7ff169bf2c3d1588@postgresql.org>
References: <16784-7ff169bf2c3d1588@postgresql.org>

PG Bug reporting form <noreply@postgresql.org> writes:
> The following query (borrowed from regression tests):
> ...
> leads to a server crash with the following stacktrace:

Duplicated here.

> The first bad commit is 2fd6a44a.

I suspect the culprit is 1f39bce02 (but it's still Jeff's fault ;-)).
What I see happening is that the second time through ExecReScanAgg
crashes here:

            MemSet(node->pergroups[setno], 0,
                   sizeof(AggStatePerGroupData) * node->numaggs);

because node->pergroups[0] is now NULL, which is the fault of
this bit in agg_refill_hash_table:

    /* there could be residual pergroup pointers; clear them */
    for (int setoff = 0;
         setoff < aggstate->maxsets + aggstate->num_hashes;
         setoff++)
        aggstate->all_pergroups[setoff] = NULL;

I suspect this is clearing the wrong subset of the all_pergroups
pointers, but the code is so underdocumented that I'm not very
sure.

			regards, tom lane





view thread (3+ messages)  latest in thread

Message-ID: <553495.1608578766@sss.pgh.pa.us>
Permalink:  ../553495.1608578766@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/553495.1608578766@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-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, exclusion@gmail.com, pgsql@j-davis.com
  Subject: Re: BUG #16784: Server crash in ExecReScanAgg()
  In-Reply-To: <553495.1608578766@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