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 1vM7HE-001LoZ-3D for pgsql-hackers@arkaria.postgresql.org; Thu, 20 Nov 2025 16:12:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vM7HD-002fkJ-1P for pgsql-hackers@arkaria.postgresql.org; Thu, 20 Nov 2025 16:12:55 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vM7HD-002fkB-0R for pgsql-hackers@lists.postgresql.org; Thu, 20 Nov 2025 16:12:55 +0000 Received: from mail-io1-xd2d.google.com ([2607:f8b0:4864:20::d2d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vM7HB-000Zm2-1R for pgsql-hackers@lists.postgresql.org; Thu, 20 Nov 2025 16:12:55 +0000 Received: by mail-io1-xd2d.google.com with SMTP id ca18e2360f4ac-94880628ffaso50423939f.0 for ; Thu, 20 Nov 2025 08:12:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763655170; x=1764259970; 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=++WJYlC1ri5zugH7OawMavlY2k/dWAzCEWDALiSOKDk=; b=HM+hqj3WV6f6sydR+h+qSpTEvOli5QSXrwLEhmFBtPNvuaruxbzXNYjleOSezQHRxP KTVKfQNId7q/IPuBJeWWVkuDaD9sdqw+l4LXYZQiIM7aplU56wx1euLUbPPMh+JIFLC0 9h77imR36LOD4KJN87r4mBcvboErpdjPe/CvKe7BvFjo6yQXXCX/LxgCWhiyFW+HE8K2 /7m+MZf6JczUcaZrwbwm5z/CbtbI2ZxCGj1RxGK1ariPhxhXtW9Rpbw3NrMGZbZAMgqJ h84W6KRUXH12F7raTVjMshTOd4MqNodU5JuqHlLqOMjSsJFni6azAklZCGeq6vu9uJLY I0JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763655170; x=1764259970; 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=++WJYlC1ri5zugH7OawMavlY2k/dWAzCEWDALiSOKDk=; b=NMb7esbUfnY8bw9IWyPrk9MzUcYVt5XLHAElJC1H56dsz90vWBFDGFBcpzUCVIvZ3M /3mb1pm/Ou0Cg7dt954zHHbeMlaRMa9eFSAMYLv1ZfxD9NcnPArLnjIT/Fab15YTa1XU YTmz8y+Ix+Ie/kHt545bZSFQL+gLIai9DW4xe8wSGYsdsR1d86TcwpA4/9v7s+ZUYBEL 9ZpoQCpMyJDyg1ucYQao/rJngFy+tZ+9tPeK4seaBDlTLk/4A8CNEGKj9/LNgdrhfvsK HE6vujIINZGttAhItbSM1gimJF8rGkM2T4P2j+t/q0Hi/FwERCz2Ps2l+zodTJ8me340 a5Tw== X-Forwarded-Encrypted: i=1; AJvYcCWyexcB3eOfhkxR9Mvl5JcH7YEZb/gncbqSJwPwGj8ElrXqOUAjqtcgQw4fSGWw9EqG3Mkfz8Dg3NtQusM3@lists.postgresql.org X-Gm-Message-State: AOJu0YwXRVj90rCXaM3iPLfmgHw35l6KpGfNBIlpH9OVgsBGY7s/Z8vZ ESrCd2EyvFKXwdc6Th7LzBN5LGG9J1bv294AwssmsY0Q978j7saQv5U/ X-Gm-Gg: ASbGncvxOwvxTy14V9hrnDyILjaYGUj8oDsgqYBGAk2Rr3DlpZUNcKHQM3d14XI2iCQ U6v74022F+qBUOwfG7HAaiBUlgPWoe/MNC8gT8+RwQ5bLjXLmmvCMuQqytLit64Ao56fifKqvBm sPiocGjnztZol11ZLpSsT6i66F41N8oDWkqU63tQo+qLMdovZ18byDXUAWNXY0sifXpjVy773C9 EaMRR0HJxR464vydEX+/XYLt3Rt/73TC+Kc+NaxadnU4c7w4nOdGPJn77l1mCsIWPX9ETQedo44 P2zV2Z7a74IicPvfllcVb7lLjXor3b2KMrEoPMeSlLPGjZItBsaZhoR2RMT4KJ+JlUez3PBcSp0 Rd9BaVMCmFyzG3Kp9tJK/gHlYA63aoglgHXRIpU3dfqv1xHNRnZjBnHeXx8t9sFfL9qznUjwhPP x8t8Ffljoqd65Z8/lVuB5vCl+8o/EADFdi9wEGV5Dc9JBY/10f6oKt3bckB8WhyfZRIRpWLHcTz qmw X-Google-Smtp-Source: AGHT+IE0fFjPlNQDHNJC8dUsZpm+RKNPC9ie4vcmnVEAhn9d6RfZlg27fufInBJZXChXH7FIBleAgw== X-Received: by 2002:a05:6638:c3e1:b0:5b7:d710:6632 with SMTP id 8926c6da1cb9f-5b956973ad9mr2580779173.11.1763655169951; Thu, 20 Nov 2025 08:12:49 -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-5b954a45bc9sm1076570173.24.2025.11.20.08.12.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 08:12:49 -0800 (PST) Date: Thu, 20 Nov 2025 10:12:47 -0600 From: Nathan Bossart To: Robert Haas Cc: Nathan Bossart , 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 Thu, Nov 20, 2025 at 10:44:31AM -0500, Robert Haas wrote: > Now, perhaps the chances of an initialization failure in practice are > quite low. Maybe a typical initialization function won't do anything > that could fail. But it just seems weird to me to design something > that thinks errors are likely enough that it's worth having some > amount of mechanism to deal with them, but unlikely enough that it's > not worth making that mechanism more robust. Well, I will attempt to convince you that is indeed the case, although I'm not sure I will succeed... ISTM that besides pure coding errors, the most likely reasons for an ERROR during DSM segment initialization are things like out-of-memory, too many LWLock tranches registered, etc. In those cases, do we want every single backend that tries to attach to the segment to retry and most likely fail again? And what if the initialization callback completed halfway before failing? Do we expect every extension author to carefully craft their callbacks to handle that? On the other hand, if we don't handle ERRORs and someone does run into an OOM or whatnot, do we want other backends to attach and use the unitialized segment (leading to things like seg-faults)? Tracking whether an entry was initialized seems like cheap insurance against these problems. Finally, the only report from the field about any of this involves SQLsmith allocating tons of LWLock tranches via test_dsa, which has been fixed independently. So I have no evidence to suggest that we need to make it more robust. In fact, without this one arguably contrived report, I probably wouldn't have done anything at all. I'll grant you that this is a judgment call. I tried to find a good middle ground, but I would be unsurprised to learn that other committers would have done things differently. -- nathan