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.96) (envelope-from ) id 1wvH0A-001AnH-0E for pgsql-bugs@arkaria.postgresql.org; Sat, 15 Aug 2026 16:12:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wvH06-004FbB-1N for pgsql-bugs@arkaria.postgresql.org; Sat, 15 Aug 2026 16:12:51 +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.96) (envelope-from ) id 1wvH06-004Fb3-0X for pgsql-bugs@lists.postgresql.org; Sat, 15 Aug 2026 16:12:51 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wvH04-00000000m0S-2Cux for pgsql-bugs@lists.postgresql.org; Sat, 15 Aug 2026 16:12:49 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.18.1/8.18.1) with ESMTP id 67FGCTQg016449; Sat, 15 Aug 2026 12:12:29 -0400 From: Tom Lane To: Konstantin Knizhnik cc: Heikki Linnakangas , PostgreSQL mailing lists Subject: Re: SIGSEGV in dynahash In-reply-to: References: Comments: In-reply-to Konstantin Knizhnik message dated "Sat, 15 Aug 2026 16:06:53 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <16447.1786810349.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Sat, 15 Aug 2026 12:12:29 -0400 Message-ID: <16448.1786810349@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Konstantin Knizhnik writes: > On PG19,|ShmemInitHash|always builds afixed-sizeshared hash with abump > allocator(|ShmemHashAlloc|) whose|alloc_arg|is astack-localregion used > only during|hash_create|. After init, that pointer is dead. > ... > Pre-PG19, shared hashes used|ShmemAllocNoError|from the global pool, so > a failed grow tended to return|NULL|/ error instead of faulting on a > dead bump allocator. > It was introduced by commit 9fe9ecd516b — Allocate all parts of shmem > hash table from a single contiguous area Yeah. I'm not too pleased with 9fe9ecd516b for a different reason. In pursuit of what seems to be a merely cosmetic goal (ie make shared hashes be reported differently in pg_shmem_allocations), it's made a fundamental and IMO possibly destabilizing change in the behavior of shared-memory hash tables. To wit, it is no longer possible to expand a shared hash table beyond its startup-time allocation. For some of them that doesn't matter, but for others it definitely does; the lock table in particular is sized only heuristically. For the last couple of decades, there was slop in the max_locks_per_transaction limit because the lock table could grow into the 100kB slop space we leave in shared memory; but now there is no slop. I suspect we will get complaints from people whose workloads used to work without trouble and now don't. There might be extension code that depends on shared hashtables not having a hard limit, too. I wonder whether we shouldn't just revert this. regards, tom lane