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 1pnpAl-00086a-QH for pgsql-hackers@arkaria.postgresql.org; Sat, 15 Apr 2023 23:19:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pnpAk-0006Xb-MY for pgsql-hackers@arkaria.postgresql.org; Sat, 15 Apr 2023 23:19:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pnpAk-0006XS-8V for pgsql-hackers@lists.postgresql.org; Sat, 15 Apr 2023 23:19:10 +0000 Received: from mail-io1-xd29.google.com ([2607:f8b0:4864:20::d29]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1pnpAi-00383w-2d for pgsql-hackers@postgresql.org; Sat, 15 Apr 2023 23:19:09 +0000 Received: by mail-io1-xd29.google.com with SMTP id ca18e2360f4ac-7606d44604aso145308539f.1 for ; Sat, 15 Apr 2023 16:19:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20221208.gappssmtp.com; s=20221208; t=1681600746; x=1684192746; 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=Ge7gCQvHBqWQILw3yxjx0/u+KdATL+9AIvAonbBetdk=; b=HKGCOw5chwGGx9N/Xg7nMLFOrIJWGKBrqro8Wxk/dEDgtDoFUB7DSs+jFQcMQUVULK oztA4o0Tui9zG8sDYKtzylp6s+GHqFjU24jmgZIgjQQzLIvyvbiPcqRTpauqOFihBFqn odNUkMDh+faAwQofQjATQZGWm6P8Cy8lwRutuI42Iik0mUokOiBS5EwLF6IyrxsptpjJ SFO/OsTtAPv3inpDkZPAyJdstXSAMbiVl25p1eUx4ERcUDCTJ1SCNZfAKz2NFnU9C2Y2 wVNoshLfFd2oNLWG/X1xmbGVodKB+7bHfgXjhIKf1CZSy8VGE+UGqFNymw6FRG4uOMZ9 YIFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681600746; x=1684192746; 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=Ge7gCQvHBqWQILw3yxjx0/u+KdATL+9AIvAonbBetdk=; b=JLGnmg9bNKRgs9UtkuCmNPFAWdG59bPwhHl5DjgWRo2jcASTMQGjeekHzV2L/YDCck /ZxbjC5mrkTw4UHdxwNQZEqV0iLGRzGHCY6PaSjRbc8ccqiILhIwaD2za5yRZA2Nq/5+ SINCpszj2+Ze/phl4gY7uSilX1oUPeOA6qi/4riqjrrbJ0kcFWZwajnc/1F8QzdMoVOI rZSWxim2CHGyuvSXoIXqlW3Wr1UWlfbuFlOBYM1l5u+tiMB4NayeXJaEPUNJd5oAVppB 6NV+SKvsxYCeEOMyh6Iaxd+3c1rd0EvAoXPpe1m/Y+rmyWwNlj33nlHWZoMtlU+a2p6u aC0g== X-Gm-Message-State: AAQBX9dlAJqBZQB7k4Y028P2BAtRoj5lsS/fu5iauwaPeHrOR/LNKXwc GKZmN/Z5qpVUGU6RH58FPpRbUw== X-Google-Smtp-Source: AKy350YsIi9qD7Jnfz4gLDKKxv5rhtrw+IaNtklJfLYd8m1JqFdgbQStT1SA06OEj8u7YzXtnXr5yg== X-Received: by 2002:a92:c007:0:b0:329:577a:3d13 with SMTP id q7-20020a92c007000000b00329577a3d13mr5244871ild.1.1681600745843; Sat, 15 Apr 2023 16:19:05 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id b9-20020a026f49000000b0040be6f1d6c0sm2218695jae.37.2023.04.15.16.19.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Apr 2023 16:19:05 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id A539A8005DC; Sat, 15 Apr 2023 18:19:04 -0500 (CDT) Date: Sat, 15 Apr 2023 18:19:04 -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: multipart/mixed; boundary="YPqfEcOblDn107oa" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --YPqfEcOblDn107oa Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sat, Apr 15, 2023 at 11:33:58AM +1200, David Rowley wrote: > On Sat, 15 Apr 2023 at 10:48, Justin Pryzby wrote: > > > > On Sat, Apr 15, 2023 at 10:04:52AM +1200, David Rowley wrote: > > > Which aggregate function is being called here? Is it a custom > > > aggregate written in C, by any chance? > > > > That function is not an aggregate: > > There's an aggregate somewhere as indicated by this fragment from the > stack trace: > > > #12 project_aggregates (aggstate=aggstate@entry=0x607200070d38) at ../src/backend/executor/nodeAgg.c:1377 > > #13 0x0000000000903eb6 in agg_retrieve_direct (aggstate=aggstate@entry=0x607200070d38) at ../src/backend/executor/nodeAgg.c:2520 > > #14 0x0000000000904074 in ExecAgg (pstate=0x607200070d38) at ../src/backend/executor/nodeAgg.c:2172 > > Any chance you could try and come up with a minimal reproducer? You > have access to see which aggregates are being used here and what data > types are being given to them and then what's being done with the > return value of that aggregate that's causing the crash. Maybe you > can still get the crash if you mock up some data to aggregate and > strip out the guts from the plpgsql functions that we're crashing on? Try this --YPqfEcOblDn107oa Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="postgresql-2023-04-14_202642.log.txt" CREATE OR REPLACE FUNCTION avfinal(x anycompatiblearray) RETURNS anycompatiblearray LANGUAGE plpgsql AS $$ DECLARE res real[]; BEGIN res := ARRAY_FILL(x[1], ARRAY[4]); RETURN res; END; $$; CREATE OR REPLACE FUNCTION acc(x anycompatiblearray, y anycompatiblearray) RETURNS anycompatiblearray LANGUAGE plpgsql AS $$ BEGIN RETURN ARRAY_FILL(y[1], ARRAY[4]); END; $$; CREATE OR REPLACE AGGREGATE public.av(anycompatiblearray) ( STYPE = anycompatiblearray, INITCOND = '{{0},{0}}', SFUNC = acc, FINALFUNC = avfinal ); CREATE OR REPLACE FUNCTION aw(real[]) RETURNS void LANGUAGE plpgsql AS $function$ begin end $function$; SELECT aw(av(ARRAY[1.0::real])), aw(av(ARRAY[1.0::real])), 1; --YPqfEcOblDn107oa--