Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1v9TqL-001AyC-Bb for pgsql-bugs@arkaria.postgresql.org; Thu, 16 Oct 2025 19:40:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1v9TqJ-00FB1h-Em for pgsql-bugs@arkaria.postgresql.org; Thu, 16 Oct 2025 19:40:54 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1v9TqJ-00FB1T-2X for pgsql-bugs@lists.postgresql.org; Thu, 16 Oct 2025 19:40:54 +0000 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v9TqG-0029TR-0F for pgsql-bugs@lists.postgresql.org; Thu, 16 Oct 2025 19:40:53 +0000 Received: by mail-pg1-x52e.google.com with SMTP id 41be03b00d2f7-b6271ea39f4so773036a12.3 for ; Thu, 16 Oct 2025 12:40:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20230601.gappssmtp.com; s=20230601; t=1760643651; x=1761248451; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=QRLBECqs5mWCYx5Q850A17diOqwEcSkv6kAqBwbCZ0Y=; b=AoOs62Bn+x3cDKU4RkuLnVpn7Gjt7dnUP3oqtn1GkuUjlqioo1gVM6cNRagRj/z4+T 27p3UL1h3dcqHoct8HT7PuguL2y2yK9/J8XCi8aNeFxwiEOO46/XJ37Okh0Y4A84B6Vt XwSAJ4kTgdDWBGFLlqFmoDWZe5yvUULo2QzANuMV/FbMmlOclOV92CrM/+tzSOaPiwNF RnGUuVa/k9jMbxIQJzQiaa0ohVcWkMvn4IFJ7OATxODFI2nigJa8K+qIK6/F9iiSAs2s rF09MZPTP6a0uGmUQC2C73ERpus1OE6wwhfJUOEUnMPnGEHLrhshzadRKK1+Ve26JyE1 6UJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760643651; x=1761248451; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=QRLBECqs5mWCYx5Q850A17diOqwEcSkv6kAqBwbCZ0Y=; b=COt3sPCSu0h2Q8Pdho2N+T5IGZymXnoM92rKLv+rci0YJ9ZT0i2Uf8E/7MGKS9M6YA WXJnSIo6lbPY4kOqSPpE9oBHs9adz04FV/+lWricd2DNxRKP+d48SKJuddbCHHhRRLwy /efxchzvrWVNed39/s5rJ/jHAHWdP0apavF68LLLtg4g7SZ3QQxYb4i2+koqvLExRK9U kh34KcbXXcyrNWn4jQuMGKi4IlptfPZGcGuXU9iQmc91aM9fRN39U8gytJvGP601rklc Mzws+my4mnglCexl2vwqzkEqPDe+/d4Hv/DwS/HuBbjM+AKTJbEUIE8vUI3RVeOk+0cm NNpA== X-Gm-Message-State: AOJu0YxxSaBFIhLDSY/p6cp5muhJhKZVo9XbGOsowUZwZTSa8CyFvV4t jVjl51if87mawe2NCznsiHxS1c4TutxlD1QzKULhfdXQp1DPo1196im/YKHogmdM4g== X-Gm-Gg: ASbGncu90A/5nOpHJviNH+uzHzwfZ6YCIv6TiWedhwct2FPqfOWxQJBCi3ySzXISGtp b4Shw7tghhulzFmgXC0ODxbHxxN2jpa+8NKpMR+SgOeaDZtBDK11HF44hIF9yFDKH3hpobNZnZx WIR0koUtsD6ETdtuM/Z9EQGAJsZSR5cRQv1k+wgKRmckBxfOQ4myBkE8k4OTWQjQnRIv5hjLpB1 eghZm5DFXhSCpYBmXNOLLGCEId5zoaoQfVVK0FltPT+Xr4AQRyZeFIyGU7Zush/UdDlS/pps5jL F/zW3Wcks9iI89zM3k0KUW1OTyquIpDZo0wJTL+WMj+XSA5gKPQ5n/C2/ABMOEYiOIJd4P+wyDT 72bN/Gyee5jlE3kCe32LUdTs2ABzT6vNbQf5XDfqRsMKFdx3QNWQQAC5gcB0g7+z3p6dmpnhiE7 Mf0yKc3U5LcbLmOAFAsk24qs3Fv+So77EmJwJwEK1+bJE= X-Google-Smtp-Source: AGHT+IGzD/zNJT4V+Zvvt7Bza7J3A3SB9rwYdX8pGWoCyuXLcOVllJN/lnO8lrcdAZNmmul3rhJOfw== X-Received: by 2002:a17:903:1a70:b0:268:15f:8358 with SMTP id d9443c01a7336-290cb080e21mr13335105ad.42.1760643650824; Thu, 16 Oct 2025 12:40:50 -0700 (PDT) Received: from jeff-ws-bridge.lan (c-24-7-19-3.hsd1.ca.comcast.net. [24.7.19.3]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-33bd79b344dsm250767a91.3.2025.10.16.12.40.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Oct 2025 12:40:50 -0700 (PDT) Message-ID: <514ea5ef5120c380856226ec98951a55ef6f40c3.camel@j-davis.com> Subject: Re: BUG #19078: Segfaults in tts_minimal_store_tuple() following pg_upgrade From: Jeff Davis To: David Rowley , Yuri Zamyatin , Amit Langote Cc: pgsql-bugs@lists.postgresql.org Date: Thu, 16 Oct 2025 12:40:49 -0700 In-Reply-To: References: <19078-dfd62f840a2c0766@postgresql.org> <614d31c9bef9152f90a60bb968f7e855e6164e9c.camel@j-davis.com> <3b5kvjfavnciubmv7zefmzknlraehlfxufs724nqof7f7x5doh@4qiaendsrrmk> <4snsumdqugwza34lnc3vivg63i7s6imql5qopxcmg4xul4w3ft@o3gn2tanz3a3> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.52.3-0ubuntu1 MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 2025-10-16 at 11:51 +1300, David Rowley wrote: > I forgot to mention, this isn't the same thing as the > tts_minimal_store_tuple() issue you first reported, so if there is a > problem there, this one has nothing to do with it. I investigated, but came up empty so far. Any additional info on the hashagg crash would be appreciated. I appended my raw notes below in case someone notices a mistake. Regards, Jeff Davis Raw notes: * Somehow entry->firstTuple=3D=3D0x1b, which is obviously wrong. * The entry structure lives in the bucket array, allocated in the metacxt using MCXT_ALLOC_ZERO, so there's no uninitialized memory floating around in the bucket array. * The metacxt (aggstate->hash_metacxt) is an AllocSet, and it's never reset. It contains the bucket array as well as some ExprStates and an ExprContext for evaluating hash functions. * Hash entries are never deleted, but between batches the entire hash table is reset (which memsets the entire bucket array to zero). * The entry->firstTuple is assigned only in one place, from ExecCopySlotMinimalTupleExtra(). The 'extra' argument is a multiple of 16. * ExecCopySlotMinimalTupleExtra() does some interesting pointer math, but I didn't find any path that could plausibly return something like 0x1b. The memory is allocated with palloc/palloc0, which cannot return zero, and 0x1b is not a multiple of 16 so seems unrelated to the extra argument. * JIT does not seem to be involved, because it's going through ExecInterpExpr(). * When the hash table grows, it invalidates previously-returned entry pointers. But, given the site of the crash, I don't see that as a problem in this case.