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 1vNe4M-009q4R-21 for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Nov 2025 21:25:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vNe4K-004Y7r-0a for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Nov 2025 21:25:56 +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 1vNe4J-004Y7j-2r for pgsql-hackers@lists.postgresql.org; Mon, 24 Nov 2025 21:25:56 +0000 Received: from mail-il1-x12a.google.com ([2607:f8b0:4864:20::12a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vNe4H-001GrC-1p for pgsql-hackers@lists.postgresql.org; Mon, 24 Nov 2025 21:25:55 +0000 Received: by mail-il1-x12a.google.com with SMTP id e9e14a558f8ab-433261f2045so20385515ab.3 for ; Mon, 24 Nov 2025 13:25:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764019553; x=1764624353; darn=lists.postgresql.org; 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=dgkxrZ+QW/bIJGBK0A+e/vXrZ2s1yxqugQwKByM9A5s=; b=jlYMKDkW3DSkwciMMRh3QsLRfaERTK3sowJyP863rETS42zLZSpOGQq6dZ8BPGZgJe qZagBVMQCvtZfKpjexgTR3iWwczNBkNlqsl9gI2qL8svBgwvytTD0ttbR60qa39iYt0a FxFB1CRBjlB7ar5nX9QT5L9A91sMVdexLvPvDplytDOYvNWVOC83GwauBTbehWetmun9 EP4KmxkMi90/au9qUzet0c+wrHkjscnI8g8ZV/i/lHye5MCelP//IiQvpwhY2NT/UUzA PVjkMAix0eVa6yk19wwGGOaCdDJnYXUFe+3tyX8ln5LFPeexoGJjwBObSCkEhT2GSRQT TgWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764019553; x=1764624353; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dgkxrZ+QW/bIJGBK0A+e/vXrZ2s1yxqugQwKByM9A5s=; b=tYD4Ru28vALxMcReCiJU17CfNHiN/2957CyzTi/jODNTlfOvDIt31Y95tejFVBjJIT gQT97RipBhLJt2jgfuZxP3rs4fALxaxjFlanBdDFF7AVS6ybACdUjpAAX2jA82dkMIvB Wk495T2N0TheFesQyRqEnt1IeJPLeoYFpMKV1i35Eifb1WVWJzpYbgPXaY6qkv4KqW77 6/r2zOxbq+klHVvywTVeHTtIFwfb1V38wn0knkuyWvGjUSA9GSXgYixIa2nFKVnMu8HW S/zCBTwWnrIhgGEsZTdSYhchpv5V66gJLV3Fgps8ZMiC4P/Azi+RmeMpYIbuI0+Bc2h6 ikmA== X-Gm-Message-State: AOJu0Yyf+1prHzAnpwBz6hG2vibcY77JFsmIpk24lmhpLAOJ2DVCjQus 9rcjlaqTFa1KZiWXvTGWRRRTzA4wi9ptgmGXyWMCZKusDVgeqTOZe5mNmbEu8Q== X-Gm-Gg: ASbGncvQsb50sJaxKnvRZZXemNA5Vpz7515uXrJ2d1s7ta6r3UE5NRR470s9lHezNmS NATA6QaUZXtK1j6ZvOa8tQI6VhwQST9XwlFm98X9UAW8a9B1h+UaBBl27RuC/6EmGKHLoTtLxg1 +Thkkfj94zhH7/9oXENFgoK8p0Khof0MumN8sOP3MYTawapqelCoX+IVQZv79HnrFEqMuXHy17r T5Jh8K9hN/MINzVdqsIo+LAdRpC7ZPWAPSQ5WjYFlqI7qA11JSnDg+iezBp72VkS88lzjNdVMOw zSizPi8FDM9eNoH7/tkBLuHJ13ZnQNEInjuZIJwws6bvc14QQE6MmsxAsFYAHS7ZdgImJ0c6hrp ZO42xADsXy3ZW/jhoSHc+5jdElpgq1MWQXLumjihzmfu/x8ridwjuiQyfp0OcVPWPB+DA+42Mws /W9eFuXc0m1SjmgLSeeJZIOP9C3HZSKdyogeeuxl3nI+eGdtBblxN/6peqgBtCBDO5CnEy48cHu rMy X-Google-Smtp-Source: AGHT+IHsYDJqjmxDi7mOfoCP0BKA9IDelR3Z3fuafZ/VJoOPNyVnJemruUZucw5sRfMaa0rvnN6niQ== X-Received: by 2002:a05:6e02:1a23:b0:433:4ac7:13bb with SMTP id e9e14a558f8ab-435b8c324damr114448595ab.11.1764019553504; Mon, 24 Nov 2025 13:25:53 -0800 (PST) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-5b954b210fdsm6160410173.30.2025.11.24.13.25.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Nov 2025 13:25:52 -0800 (PST) Date: Mon, 24 Nov 2025 15:25:51 -0600 From: Nathan Bossart To: Robert Haas Cc: PostgreSQL Hackers Subject: Re: pgsql: Teach DSM registry to ERROR if attaching to an uninitialized ent Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Nov 24, 2025 at 04:02:18PM -0500, Robert Haas wrote: > I haven't done a full review of this and I'm not sure whether you want > me to spend more time on it... I'd appreciate an eyeball check if you have the time. > I'm guessing that the reason why that doesn't easily work is > because you're relying on those locks to prevent multiple backends > from doing the same initialization? For GetNamedDSMSegment(), I bet we could avoid needing a PG_CATCH by taking the DSMRegistryLock exclusively when accessing the registry. But for GetNamedDSA() and GetNamedDSHash(), we want to keep the half-initialized entry so that we don't leak LWLock tranche IDs. I initially thought that might be okay, but if every backend is retrying, you could quickly run out of tranche IDs. -- nathan