Re: v16dev: invalid memory alloc request size 8488348128 - Mailing list pgsql-hackers

From Justin Pryzby
Subject Re: v16dev: invalid memory alloc request size 8488348128
Date
Msg-id ZDnYM8ONbQmKjxSO@telsasoft.com
Whole thread Raw
In response to Re: v16dev: invalid memory alloc request size 8488348128  (David Rowley <dgrowleyml@gmail.com>)
Responses Re: v16dev: invalid memory alloc request size 8488348128
List 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@telsasoft.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




pgsql-hackers by date:

Previous
From: Daniel Gustafsson
Date:
Subject: Re: [PATCH] Add `verify-system` sslmode to use system CA pool for server cert
Next
From: Thomas Munro
Date:
Subject: Re: Direct I/O