Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pGLYl-0005hg-6f for pgsql-bugs@arkaria.postgresql.org; Fri, 13 Jan 2023 15:01:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pGLYk-0007O8-1i for pgsql-bugs@arkaria.postgresql.org; Fri, 13 Jan 2023 15:01:34 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pGLYj-0007Nz-Pn for pgsql-bugs@lists.postgresql.org; Fri, 13 Jan 2023 15:01:33 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pGLYh-00060s-Rn for pgsql-bugs@lists.postgresql.org; Fri, 13 Jan 2023 15:01:32 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 30DF1ORc1676516; Fri, 13 Jan 2023 10:01:24 -0500 From: Tom Lane To: Alvaro Herrera cc: Mats Kindahl , daniel@yesql.se, pgsql-bugs@lists.postgresql.org Subject: Re: Crash during backend start when low on memory In-reply-to: <20230113115352.sbuv5egpjyoxn52i@alvherre.pgsql> References: <20230113115352.sbuv5egpjyoxn52i@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Fri, 13 Jan 2023 12:53:52 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1676514.1673622084.1@sss.pgh.pa.us> Date: Fri, 13 Jan 2023 10:01:24 -0500 Message-ID: <1676515.1673622084@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Alvaro Herrera writes: > On 2023-Jan-13, Mats Kindahl wrote: >> I have an improved patch based on raising an error when malloc fails. > Hmm, but I'm not sure I like what you did to BackendStartup: Yeah, the BackendStartup change is 100% wrong; it is replacing perfectly good code that recovers correctly with bad code that will take down the postmaster (not a backend child!) on OOM. By and large I don't like anything about this patch. You could get the same results (i.e. elog(ERROR) on OOM) by replacing the malloc calls with pallocs. regards, tom lane