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 1pnQ9u-0003Dv-C9 for pgsql-hackers@arkaria.postgresql.org; Fri, 14 Apr 2023 20:36:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pnQ9t-00057f-2Y for pgsql-hackers@arkaria.postgresql.org; Fri, 14 Apr 2023 20:36:37 +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 1pnQ9s-00057W-KF for pgsql-hackers@lists.postgresql.org; Fri, 14 Apr 2023 20:36:36 +0000 Received: from mail-io1-xd30.google.com ([2607:f8b0:4864:20::d30]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1pnQ9p-002vMu-OC for pgsql-hackers@postgresql.org; Fri, 14 Apr 2023 20:36:35 +0000 Received: by mail-io1-xd30.google.com with SMTP id ca18e2360f4ac-7606d6b3294so97860139f.2 for ; Fri, 14 Apr 2023 13:36:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20221208.gappssmtp.com; s=20221208; t=1681504591; x=1684096591; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=r7Qy3mEKRjU/6jsncpQVx5dTiKEf/IS57uhypn81Sg8=; b=3QT1/s++hWW/4slfy+uoC8nz0fjdxdphoEmq4dWqryfe0aUuobysjIcYIFu0Fe9wOJ QvlUS8H8kYLQKFtdaANSQi3z+H5vDHWhcJTmDq+YkFO2UrJQb5Fx0uuGNQTo/7jvaMtW LqeCI2x91T2vgtjvOsQVZZ+aiHVzVC1kEIyuf/6Ik5n6exa9b4u6phV9wm2MPMsollFw JvybbRtlgXc+u7DSElB098B2ct2HXQXNuOfNkaaMmy87Kqaz54tx06bWAOxQ1KVXmFgu nO00XXD+o2/HdkxwadvIp5bxVW3PwiC/zRzKaEZvGXULLsbO2kbCSQVFXbs2sICPViqm 2E8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681504591; x=1684096591; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=r7Qy3mEKRjU/6jsncpQVx5dTiKEf/IS57uhypn81Sg8=; b=ZxiZUVP1OoL6pLH4dEQnJRp0mlVmlapCdHw92J8d3X7YChQDi7IGWZUBUrbJU+nIE8 RxfGbWRy0xMa/3TmOtC+ajTfto38ZWesHhycPVOA6PeeS+bQJ2YybQyOjEJvRwCsq22/ 9iMUp2vq15AO0FgGWGkDaCULfKeWyv73IuVmtbsm5urK4RgokpSg3WALmyM6EoeCB1bF o+MVb554IdvOiwCiPcDDmvqIObA+Z3RQ6JpAyRTUtW+4GGm1rqVzIO1Ld+qm4Bb+emnL iespquVj7MVbGlOAt8xhv8hVu5B73pzirg1QKnLj47KalR77mR+Ku37ieb7ir5d1x3wC NIOA== X-Gm-Message-State: AAQBX9d0za8QMuxiq4x/uN29GpZZi/jZkSuYUww76E2tRLqJsu5+en4z ZlMCLAuEKlnFTytkWR19KC1Xqg== X-Google-Smtp-Source: AKy350aKJrVUVHH/a0LgInFQQb/fgOQv4Ye5XfbStfGp/aIHCVbgKyi1qvTf65W/TK8BqeRhnNgJCA== X-Received: by 2002:a92:d985:0:b0:329:485c:54e3 with SMTP id r5-20020a92d985000000b00329485c54e3mr5791824iln.29.1681504591750; Fri, 14 Apr 2023 13:36:31 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id k13-20020a056638370d00b0040da7c39465sm1459027jav.25.2023.04.14.13.36.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 13:36:31 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 501CC8004B7; Fri, 14 Apr 2023 15:36:30 -0500 (CDT) Date: Fri, 14 Apr 2023 15:36:30 -0500 From: Justin Pryzby To: pgsql-hackers@postgresql.org Cc: Tom Lane , David Rowley Subject: v16dev: invalid memory alloc request size 8488348128 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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. I reproduced the problem at this commit, but not at its parent. commit 42b746d4c982257bf3f924176632b04dc288174b (HEAD) Author: Tom Lane Date: Thu Oct 6 13:27:34 2022 -0400 Remove uses of MemoryContextContains in nodeAgg.c and nodeWindowAgg.c. #2 0x0000000001067af5 in errfinish (filename=filename@entry=0x168f1e0 "../src/backend/utils/mmgr/mcxt.c", lineno=lineno@entry=1013, funcname=funcname@entry=0x16901a0 <__func__.17850> "MemoryContextAlloc") at ../src/backend/utils/error/elog.c:604 #3 0x00000000010c57c7 in MemoryContextAlloc (context=context@entry=0x604200032600, size=size@entry=8488348128) at ../src/backend/utils/mmgr/mcxt.c:1013 #4 0x0000000000db49a4 in copy_byval_expanded_array (eah=eah@entry=0x604200032718, oldeah=0x604200032718) at ../src/backend/utils/adt/array_expanded.c:195 #5 0x0000000000db5f7a in expand_array (arraydatum=105836584314672, parentcontext=, metacache=0x7ffcbd2d29c0, metacache@entry=0x0) at ../src/backend/utils/adt/array_expanded.c:104 #6 0x00007f6c05a6b4d0 in plpgsql_exec_function (func=func@entry=0x6092004a4c58, fcinfo=fcinfo@entry=0x7f6c04f7efc8, simple_eval_estate=simple_eval_estate@entry=0x0, simple_eval_resowner=simple_eval_resowner@entry=0x0, procedure_resowner=procedure_resowner@entry=0x0, atomic=atomic@entry=true) at ../src/pl/plpgsql/src/pl_exec.c:556 #7 0x00007f6c05a76af4 in plpgsql_call_handler (fcinfo=) at ../src/pl/plpgsql/src/pl_handler.c:277 #8 0x00000000008b30cd in ExecInterpExpr (state=0x7f6c04fd6750, econtext=0x6072000712d0, isnull=0x7ffcbd2d2fa0) at ../src/backend/executor/execExprInterp.c:733 #9 0x00000000008a6c5f in ExecInterpExprStillValid (state=0x7f6c04fd6750, econtext=0x6072000712d0, isNull=0x7ffcbd2d2fa0) at ../src/backend/executor/execExprInterp.c:1858 #10 0x000000000090032b in ExecEvalExprSwitchContext (isNull=0x7ffcbd2d2fa0, econtext=0x6072000712d0, state=0x7f6c04fd6750) at ../src/include/executor/executor.h:354 #11 ExecProject (projInfo=0x7f6c04fd6748) at ../src/include/executor/executor.h:388 #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 #15 0x00000000008d90e0 in ExecProcNodeFirst (node=0x607200070d38) at ../src/backend/executor/execProcnode.c:464 #16 0x00000000008c1e5f in ExecProcNode (node=0x607200070d38) at ../src/include/executor/executor.h:272 #17 ExecutePlan (estate=estate@entry=0x607200070a18, planstate=0x607200070d38, use_parallel_mode=false, operation=operation@entry=CMD_SELECT, sendTuples=true, numberTuples=numberTuples@entry=0, direction=direction@entry=ForwardScanDirection, dest=dest@entry=0x7f6c051abd28, execute_once=execute_once@entry=true) at ../src/backend/executor/execMain.c:1640 #18 0x00000000008c3ffb in standard_ExecutorRun (queryDesc=0x604200016998, direction=ForwardScanDirection, count=0, execute_once=) at ../src/backend/executor/execMain.c:365 #19 0x00000000008c4125 in ExecutorRun (queryDesc=queryDesc@entry=0x604200016998, direction=direction@entry=ForwardScanDirection, count=count@entry=0, execute_once=) at ../src/backend/executor/execMain.c:309 #20 0x0000000000d5d148 in PortalRunSelect (portal=portal@entry=0x607200028a18, forward=forward@entry=true, count=0, count@entry=9223372036854775807, dest=dest@entry=0x7f6c051abd28) at ../src/backend/tcop/pquery.c:924 #21 0x0000000000d60dc8 in PortalRun (portal=portal@entry=0x607200028a18, count=count@entry=9223372036854775807, isTopLevel=isTopLevel@entry=true, run_once=run_once@entry=true, dest=dest@entry=0x7f6c051abd28, altdest=altdest@entry=0x7f6c051abd28, qc=, qc@entry=0x7ffcbd2d3580) at ../src/backend/tcop/pquery.c:768 #22 0x0000000000d595fd in exec_simple_query ( query_string=query_string@entry=0x6082000cf238 "... #23 0x0000000000d5c72c in PostgresMain (dbname=dbname@entry=0x60820000b378 "postgres", username=username@entry=0x60820000b358 "telsasoft") at ../src/backend/tcop/postgres.c:4632 #24 0x0000000000bddc19 in BackendRun (port=port@entry=0x60300000fc40) at ../src/backend/postmaster/postmaster.c:4461 #25 0x0000000000be2583 in BackendStartup (port=port@entry=0x60300000fc40) at ../src/backend/postmaster/postmaster.c:4189 #26 0x0000000000be2a05 in ServerLoop () at ../src/backend/postmaster/postmaster.c:1779 #27 0x0000000000be436b in PostmasterMain (argc=argc@entry=9, argv=argv@entry=0x600e0000df40) at ../src/backend/postmaster/postmaster.c:1463 #28 0x00000000009c33d5 in main (argc=9, argv=0x600e0000df40) at ../src/backend/main/main.c:200 (gdb) fr 4 #4 0x0000000000db49a4 in copy_byval_expanded_array (eah=eah@entry=0x604200032718, oldeah=0x604200032718) at ../src/backend/utils/adt/array_expanded.c:195 195 eah->dims = (int *) MemoryContextAlloc(objcxt, ndims * 2 * sizeof(int)); (gdb) p ndims $1 = 1061043516 -- Justin