From: Tom Lane <tgl@sss.pgh.pa.us>
To: Matt Magoffin <postgresql.org@msqr.us>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Handling memory contexts in aggregate function invoking other built-in aggregate functions
Date: Sat, 04 Dec 2021 15:04:15 -0500
Message-ID: <2693283.1638648255@sss.pgh.pa.us> (raw)
In-Reply-To: <5514A57A-967F-451A-BE04-58D97AC6480B@msqr.us>
References: <AA3A2911-8555-49C9-AA42-8A5470D1728D@msqr.us>
<2643578.1638634565@sss.pgh.pa.us>
<5514A57A-967F-451A-BE04-58D97AC6480B@msqr.us>
Matt Magoffin <postgresql.org@msqr.us> writes:
> On 5/12/2021, at 5:16 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Are you testing in an --enable-cassert build? If not, do that;
>> it might make the cause of the crashes more apparent, thanks to
>> CLOBBER_FREED_MEMORY and other debug support.
> I did build with --enable-cassert, and I did see the state argument pointer passed to numeric_avg_accum
> as 0x7f7f7f7f7f, so now I understand why that was thanks to seeing the information about what that means on the Dev FAQ, thanks for that.
So that probably means that you weren't careful about allocating your
own state data in the long-lived context (agg_context), and so it
got freed between calls.
regards, tom lane
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, postgresql.org@msqr.us
Subject: Re: Handling memory contexts in aggregate function invoking other built-in aggregate functions
In-Reply-To: <2693283.1638648255@sss.pgh.pa.us>
References: <AA3A2911-8555-49C9-AA42-8A5470D1728D@msqr.us> <2643578.1638634565@sss.pgh.pa.us> <5514A57A-967F-451A-BE04-58D97AC6480B@msqr.us> <2693283.1638648255@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