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 1qv7PP-003Il7-Nu for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Oct 2023 02:44:43 +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 1qv7PM-001nkp-PC for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Oct 2023 02:44:41 +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 1qv7PM-001njW-F6 for pgsql-hackers@lists.postgresql.org; Tue, 24 Oct 2023 02:44:41 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qv7PK-0020GD-C2 for pgsql-hackers@lists.postgresql.org; Tue, 24 Oct 2023 02:44:39 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id D07FD5C0352; Mon, 23 Oct 2023 22:44:37 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Mon, 23 Oct 2023 22:44:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1698115477; x=1698201877; bh=xf x7TLR/aJeqB0cPM6p9SuszRqogtCRQ0/I/ysRHp8Q=; b=RkkOMOr1BlaWPNhjTA jsaNaCuFy4A/3lJacJfINDRLvDLYn7AVQ9ykDbJ2wF7Dlsq1ZWy5D2Fp1m8lgwFF rgnBWe761Jf5CcxS+fwwFXDJFdXywJmPzkDUPx/l3sjcf6zLLcdqCzAYSusGBs1J C5Y8di1vgIGB+jYP3oGE4Qr5jn9BBU7xN7hCfQ/+GrhQcJ1DOp3BFmG2Xo7VHeb5 snedFcKVtcir92tGOhChOkHAEe5AK07v4940tWyzh8nWafq5Ah2rhQ0F8CPMZQJR Cy/ODVO8tkle4r+fX+HKtalAJFQIzkzWMrD3gkiH9e83OEQULoKM6DYhhewkhXAo hzlA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1698115477; x=1698201877; bh=xfx7TLR/aJeqB 0cPM6p9SuszRqogtCRQ0/I/ysRHp8Q=; b=K/gF11Osw5jg0Ag8SyjnkyJMupSYQ iP+c0h22sx9MUoELVTWszirp3mfnpWFAxGPh3ovYLRbEEfAnuHzAsv8h5ywq49PW nr4jUQsjs4/G7AvVxSKPI/gPozlybdUKwDcGNMC4Sk9U0zRsYUwt5v7ycolBgLJT sMKZvZMFHSrLzS8GpScXTeHsui7gBzbVSIeWuhY27hVJcTMyGVGrE1dhSUdLHO0Y nh9uq0vs/lr70n7WDdtPYfpjGWb/dq/tUylj7rKZLjWRH+j6z4ofn51A3tfm7ov/ fGS+P2bLS1xYRPwPOK8GUV0ZTRiPvkaR4vRLGhRcCYTg82va1TWp3/sIw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrkeejgdeitdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvvefukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeetnhgurhgv shcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucggtffrrg htthgvrhhnpedvffefvefhteevffegieetfefhtddvffejvefhueetgeeludehteevudei tedtudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe grnhgurhgvshesrghnrghrrgiivghlrdguvg X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 23 Oct 2023 22:44:36 -0400 (EDT) Date: Mon, 23 Oct 2023 19:44:35 -0700 From: Andres Freund To: Andrei Lepikhov Cc: Stephen Frost , reid.thompson@crunchydata.com, Arne Roland , "pgsql-hackers@lists.postgresql.org" , vignesh C , Justin Pryzby , Ibrar Ahmed , "stephen.frost" Subject: Re: Add the ability to limit the amount of memory that can be allocated to backends. Message-ID: <20231024024435.yaqrajcchcliwhjl@awork3.anarazel.de> References: <7912c911af51d5cf28c611190bf3d463b9209343.camel@crunchydata.com> <4edafedc0f8acb12a2979088ac1317bd7dd42145.camel@crunchydata.com> <268e0ac7-8a81-4d65-8b40-b62c4b3f1bf9@postgrespro.ru> <48548d40-634b-4943-a737-3c9d95eacf06@postgrespro.ru> <8fcb4406-49f5-4069-b8e9-197a38004ddd@postgrespro.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8fcb4406-49f5-4069-b8e9-197a38004ddd@postgrespro.ru> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2023-10-24 09:39:42 +0700, Andrei Lepikhov wrote: > On 20/10/2023 19:39, Stephen Frost wrote: > Greetings, > > * Andrei Lepikhov (a.lepikhov@postgrespro.ru) wrote: > > > The only issue I worry about is the uncertainty and clutter that can be > > > created by this feature. In the worst case, when we have a complex error > > > stack (including the extension's CATCH sections, exceptions in stored > > > procedures, etc.), the backend will throw the memory limit error repeatedly. > > > > I'm not seeing what additional uncertainty or clutter there is- this is, > > again, exactly the same as what happens today on a system with > > overcommit disabled and I don't feel like we get a lot of complaints > > about this today. > > Maybe I missed something or see this feature from an alternate point of view > (as an extension developer), but overcommit is more useful so far: it kills > a process. In case of postgres it doesn't just kill one postgres, it leads to *all* connections being terminated. > It means that after restart, the backend/background worker will have an > initial internal state. With this limit enabled, we need to remember that > each function call can cause an error, and we have to remember it using > static PG_CATCH sections where we must rearrange local variables to the > initial (?) state. So, it complicates development. You need to be aware of errors being thrown regardless this feature, as out-of-memory errors can be encountered today already. There also are many other kinds of errors that can be thrown. Greetings, Andres Freund