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 1nYlo0-0004wb-QG for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Mar 2022 09:36:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nYlnz-0000lo-P8 for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Mar 2022 09:36:55 +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 1nYlnz-0000lc-Db for pgsql-hackers@lists.postgresql.org; Mon, 28 Mar 2022 09:36:55 +0000 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nYlnw-0000IJ-N1 for pgsql-hackers@lists.postgresql.org; Mon, 28 Mar 2022 09:36:54 +0000 Received: by mail-pg1-x52d.google.com with SMTP id bc27so11820025pgb.4 for ; Mon, 28 Mar 2022 02:36:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:message-id:to:cc:subject:from:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=d2MzFFH4dW5YWUW/UYBA9LQuodjM5j84EANulUiX0b8=; b=ER+QCNwJUoxAAk8lQdwa4aZRDmN+M/W7W+mUlkvO/eij9mOgVxBJR1jdzNp02MDS2b f87+onjSc10sWj4adZuGlppNorG+pnVABu6SaZYUKdlkUxj31oWQKur1Ik+hGHNRRZfH 9ATQQPwk+fSOe1oADrj2OZuFGowj+yIt4Crm8TUrPHACLvWpiOC2S3/NCNjHQTXH513Z MmFmbzzJY7aRfZMpaOtsaZqUI5ulrKdHEEqXzYYHn/+8Jc4DeVxVHsmvfnQ7VwgoGjVf Y4gb5RjzubRa2mcY33GpD6s31yeIQfpL09OPVeS4t9GpxPYPLqVY+Licv77JJq86VQ16 U5Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:to:cc:subject:from:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=d2MzFFH4dW5YWUW/UYBA9LQuodjM5j84EANulUiX0b8=; b=yh+8eovdyj/eHrQMNPICa625l4j+QDTbU3xM0k1mun0J9QQ2CwFMr/O+2EuVdmdiLc R0r817e2flIG5BmKwKiiAgLttdLsJQl6yuXutHbmcM8f84lexJFsWX5f1ttPC34ghYev /H7drd2LdpU0A9Ezitq9F2ZmwgLwmLStIgnw3Aw92B4aT5QgnPMS9CJiPKYp6aHrWoGi 4dE5KUzPycn/diFiJbxHQ1KXW5oh1xUgCKzRk/YIjb/FjEQgnP06eqZKvarom/Ow8Lk/ UP+pejRvZbu3cL2Ua1t5jVMVi2BDs5JODo9H3dBFzvQg0W5GGaN2xg+Ri6iK22f2+0pX sivg== X-Gm-Message-State: AOAM532j+xYN/AbgToBS9NgyqrHwRFXeopzvzQZZjGWh3CBssSKpd6Uz UNJSvrV7/SfeqFn0j/M0uws= X-Google-Smtp-Source: ABdhPJzOIUHk5jyTx3gfA1XFkv2F9tzyTAX+ZvIShhOeqC/nR6BjLFtvujVeAUDMZdJW5x5s95iN9w== X-Received: by 2002:a05:6a00:4303:b0:4fa:c75b:f716 with SMTP id cb3-20020a056a00430300b004fac75bf716mr22751177pfb.29.1648460210436; Mon, 28 Mar 2022 02:36:50 -0700 (PDT) Received: from localhost (KD036014041111.ppp-bb.dion.ne.jp. [36.14.41.111]) by smtp.gmail.com with ESMTPSA id b25-20020a637159000000b00381fda49d15sm13640951pgn.39.2022.03.28.02.36.48 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 28 Mar 2022 02:36:49 -0700 (PDT) Date: Mon, 28 Mar 2022 18:36:46 +0900 (JST) Message-Id: <20220328.183646.1041002117568499041.horikyota.ntt@gmail.com> To: er@xs4all.nl Cc: pgsql-hackers@lists.postgresql.org Subject: Re: TRAP: FailedAssertion("HaveRegisteredOrActiveSnapshot()", File: "toast_internals.c", Line: 670, PID: 19403) From: Kyotaro Horiguchi In-Reply-To: References: User-Agent: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk At Sun, 27 Mar 2022 20:32:45 +0200, Erik Rijkers wrote in > On master I got a FailedAssertion("HaveRegisteredOrActiveSnapshot()" > on an assert-enabled instance and with (I think) data over a certain > length. > > I whittled it down to the attached bash (careful - it drops stuff). > It has 5 tsv-data lines (one long line) that COPY slurps into a table. > The middle, third line causes the problem, later on. Shortening the > long line to somewhere below 2000 characters fixes it again. > > More info in the attached .sh file. It is reproducible for me. Thanks for the reproducer. > If debug-assert is 'off', the problem does not occur. (REL_14_STABLE > also does not have the problem, assertions or not) It seems like related with [1]? Inserting EnsurePortalSnapshotExists() to RunFromStore fixes this but I'm not sure where is the right place to do this.. [1] https://www.postgresql.org/message-id/flat/20210623035916.GL29179%40telsasoft.com#f802617a00cee4d013ad8fa69e1af048 For someone's information, this is more readable stack trace. #0 0x00007f43aeed037f in raise () from /lib64/libc.so.6 #1 0x00007f43aeebadb5 in abort () from /lib64/libc.so.6 #2 0x0000000000b28747 in ExceptionalCondition ( conditionName=0xba2c48 "HaveRegisteredOrActiveSnapshot()", errorType=0xba2882 "FailedAssertion", fileName=0xba2870 "toast_internals.c", lineNumber=670) at assert.c:69 #3 0x00000000004ac776 in init_toast_snapshot (toast_snapshot=0x7ffce64f7440) at toast_internals.c:670 #4 0x00000000005164ea in heap_fetch_toast_slice (toastrel=0x7f43b193cad0, valueid=16393, attrsize=1848, sliceoffset=0, slicelength=1848, result=0x1cbb948) at heaptoast.c:688 #5 0x000000000049fc86 in table_relation_fetch_toast_slice ( toastrel=0x7f43b193cad0, valueid=16393, attrsize=1848, sliceoffset=0, slicelength=1848, result=0x1cbb948) at ../../../../src/include/access/tableam.h:1892 #6 0x00000000004a0a0f in toast_fetch_datum (attr=0x1d6b171) at detoast.c:375 #7 0x000000000049fffb in detoast_attr (attr=0x1d6b171) at detoast.c:123 #8 0x0000000000b345ba in pg_detoast_datum_packed (datum=0x1d6b171) at fmgr.c:1757 #9 0x0000000000aece72 in text_to_cstring (t=0x1d6b171) at varlena.c:225 #10 0x0000000000aedda2 in textout (fcinfo=0x7ffce64f77a0) at varlena.c:574 #11 0x0000000000b331bf in FunctionCall1Coll (flinfo=0x1d695e0, collation=0, arg1=30847345) at fmgr.c:1138 #12 0x0000000000b3422b in OutputFunctionCall (flinfo=0x1d695e0, val=30847345) at fmgr.c:1575 #13 0x00000000004a6b6c in printtup (slot=0x1cb81f0, self=0x1c96e90) at printtup.c:357 #14 0x000000000099499f in RunFromStore (portal=0x1cf9380, direction=ForwardScanDirection, count=0, dest=0x1c96e90) at pquery.c:1096 #15 0x00000000009944e3 in PortalRunSelect (portal=0x1cf9380, forward=true, count=0, dest=0x1c96e90) at pquery.c:917 #16 0x00000000009941d3 in PortalRun (portal=0x1cf9380, count=9223372036854775807, isTopLevel=true, run_once=true, dest=0x1c96e90, altdest=0x1c96e90, qc=0x7ffce64f7ac0) at pquery.c:765 #17 0x000000000098df4b in exec_simple_query ( query_string=0x1c96030 "fetch all in myportal;") at postgres.c:1250 #18 0x00000000009923a3 in PostgresMain (dbname=0x1cc11b0 "postgres", username=0x1cc1188 "horiguti") at postgres.c:4520 #19 0x00000000008c6caf in BackendRun (port=0x1cb74c0) at postmaster.c:4593 #20 0x00000000008c6631 in BackendStartup (port=0x1cb74c0) at postmaster.c:4321 #21 0x00000000008c29cb in ServerLoop () at postmaster.c:1801 #22 0x00000000008c2298 in PostmasterMain (argc=1, argv=0x1c8e0e0) at postmaster.c:1473 #23 0x00000000007c14c3 in main (argc=1, argv=0x1c8e0e0) at main.c:202 regards. -- Kyotaro Horiguchi NTT Open Source Software Center