Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pnSDT-0001uY-H1 for pgsql-hackers@arkaria.postgresql.org; Fri, 14 Apr 2023 22:48:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pnSDS-0007X3-3g for pgsql-hackers@arkaria.postgresql.org; Fri, 14 Apr 2023 22:48:26 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pnSDR-0007Wu-M5 for pgsql-hackers@lists.postgresql.org; Fri, 14 Apr 2023 22:48:25 +0000 Received: from mail-io1-xd2d.google.com ([2607:f8b0:4864:20::d2d]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pnSDP-0005us-16 for pgsql-hackers@postgresql.org; Fri, 14 Apr 2023 22:48:24 +0000 Received: by mail-io1-xd2d.google.com with SMTP id e22so5026609ioc.13 for ; Fri, 14 Apr 2023 15:48:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20221208.gappssmtp.com; s=20221208; t=1681512501; x=1684104501; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=foP2tgIowiijp0neXrBbIWNq4+R0i9yzuHbbpHgHbHQ=; b=la83jJg+IrpPk61dCdLyDK6COK+m4RbJ+q/dNm5EGD8Oa8Hz+K5gghN7oX8CdMKqOx /e/He7hFs52PIn6LjfQq7Wi3vadtBjpZCWkJx1vg74TR/1Z1gQ/H5XUNtd1IXY4Y4dV5 jo0IYG2H6II2WVf5VFeaGHyM1DCARc3R9XvlR+wwbIG92sGvM1oAFkMDiuevPiV2aP/R HF7/O72+3UvLwo/wCsLXd6vkRqIAsOEomVbseoQvk82Wx69afALCMHQenY+r4I3LEo/i aANQbnCwMWsF8qjV3sn13YKOYp4zqDhaZs/3wF8DArooSFAwLbgcjYFpagD27gUmBU/a XwpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681512501; x=1684104501; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=foP2tgIowiijp0neXrBbIWNq4+R0i9yzuHbbpHgHbHQ=; b=XTQrasUxDijxssLaUJl0K0SDJNvpN0AV7nkj61PHZno1cdUKCU8Don49d7YQFU4FjT b9JQmpqXggeX58pxEslSV55rPBdcA1V+3FAO7OpUknuQX62tUisCGeUbismXklR/R0vn 8fDfu6s3YY1VBlcPGPDwSlzIrckU/jMDMLj274hDcM6Ets0JMBs+21XfBheYi3J3+7VK hffKtUDUYfUBmubY8N+IM3XVdc7y7xeg9w96T+0U8HgZHGG8L824a6N4ZvS6MMvWh4DX lYAMty4lvaKJlQCQ8xY/ojVTUwdepBQrJ3v4z2ACRlacxMGDlpiYgAQ/RB0JEcfu1Ygp 5YCw== X-Gm-Message-State: AAQBX9dAASY4A/hO1UB/FS3kFC+0ahT8v1GeZzBHwaEorfsEFXiNL5pO x280UhWgEfb0pAAzDaGtY46+zA== X-Google-Smtp-Source: AKy350ZW7A25WAfUtjn5X1XfGtaP2HU8kwlBXypAgd1F4g+OR0wY52gD07QkU+H0KlYt39hMS/Ec+Q== X-Received: by 2002:a5e:8915:0:b0:760:b45d:7d54 with SMTP id k21-20020a5e8915000000b00760b45d7d54mr4679455ioj.13.1681512501545; Fri, 14 Apr 2023 15:48:21 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id m9-20020a6b7b49000000b007046e9e138esm1402096iop.22.2023.04.14.15.48.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 15:48:21 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 2AB36800594; Fri, 14 Apr 2023 17:48:19 -0500 (CDT) Date: Fri, 14 Apr 2023 17:48:19 -0500 From: Justin Pryzby To: David Rowley Cc: pgsql-hackers@postgresql.org, Tom Lane Subject: Re: v16dev: invalid memory alloc request size 8488348128 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, Apr 15, 2023 at 10:04:52AM +1200, David Rowley wrote: > On Sat, 15 Apr 2023 at 08:36, Justin Pryzby 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