Re: v16dev: invalid memory alloc request size 8488348128

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: v16dev: invalid memory alloc request size 8488348128
Date: 2023-04-14 22:48:19
Message-ID: ZDnYM8ONbQmKjxSO@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Apr 15, 2023 at 10:04:52AM +1200, David Rowley wrote:
> On Sat, 15 Apr 2023 at 08:36, Justin Pryzby <pryzby(at)telsasoft(dot)com> wrote:
> >
> > I hit this elog() while testing reports under v16 and changed to PANIC
> > to help diagnose.
> >
> > DETAILS: PANIC: invalid memory alloc request size 18446744072967930808
> > CONTEXT: PL/pgSQL function array_weight(real[],real[]) while storing call arguments into local variables
> >
> > I can't share the query, data, nor plpgsql functions themselves.
>
> Which aggregate function is being called here? Is it a custom
> aggregate written in C, by any chance?

That function is not an aggregate:

ts=# \sf array_weight
CREATE OR REPLACE FUNCTION public.array_weight(real[], real[])
RETURNS real
LANGUAGE plpgsql
IMMUTABLE PARALLEL SAFE

And we don't have any C code loaded to postgres. We do have polymorphic
aggregate functions using anycompatiblearray [*], and array_weight is
being called several times with those aggregates as its arguments.

*As in:

9e38c2bb5093ceb0c04d6315ccd8975bd17add66
97f73a978fc1aca59c6ad765548ce0096d95a923
09878cdd489ff7aca761998e7cb104f4fd98ae02

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2023-04-14 23:16:57 Re: Direct I/O
Previous Message Daniel Gustafsson 2023-04-14 22:36:40 Re: [PATCH] Add `verify-system` sslmode to use system CA pool for server cert