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 1pO8aU-0008G8-0S for pgsql-hackers@arkaria.postgresql.org; Sat, 04 Feb 2023 02:47:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pO8aS-0002NO-Ql for pgsql-hackers@arkaria.postgresql.org; Sat, 04 Feb 2023 02:47:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pO8aS-0002KW-Gi for pgsql-hackers@lists.postgresql.org; Sat, 04 Feb 2023 02:47:32 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pO8aO-0003Fe-R1 for pgsql-hackers@lists.postgresql.org; Sat, 04 Feb 2023 02:47:32 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id C7FFF5C01BA; Fri, 3 Feb 2023 21:47:26 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Fri, 03 Feb 2023 21:47:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc: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=1675478846; x=1675565246; bh=NNbnhupint sdSCPCDeybPpw8MJbi9oCk33b6bi87w1c=; b=XaAT+VlwsGeuWG405G4TqYUR6f W8ePl59h2pZ4am3WU16gTXpGYc5u32Cjz/W/Zl9Hd9GIN+JVZoozJj9fx9k8FUF9 LwwYIe6NBM5rYETGha/S6OKDoiC2IPOl2M5jgFMZrr+tjbWCzqw1FC02qByoCajJ o88DXIO5YgMAMLWzf475sljSgDwA8Fq7JZ+g4Gqb+AcXnWRCn9i341sb/hfA1E/T gTlEVKYkfG+8Ta1Wx2l8p1r1vF60j8hw2uEgjcr/s5QVsvqfiJfhIzw4PiSccYLN dFB8ue84sfU9ebjNU7s8CtUxnFl9Poacy4dLC78ePk+5TrwCsJK3IOiijB1Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc: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=1675478846; x=1675565246; bh=NNbnhupintsdSCPCDeybPpw8MJbi 9oCk33b6bi87w1c=; b=oFHPlbNMj6pfo2RFsBJ2FOGRSbmP2LkNS7LCYgao+qRE fCvytMSMJRcraWUlsEwKDU2V5u971VPCXk5hhURpDv/ROdTq4NLgx/vlvBg9xoBw pSq8QG9ZldtGNyXBvoKANa1TYjcIYx2dtG0HEXh7D83zPttS1wq4amPBceR78pJp Ixk+xyVP1pChXsFK2KCDBqh+x7rUMia8k7QTgptGLxzviqIuK3vIlqSszpIYN0tf gXZM/pPaqWIufj6jZGxyaX4GgNE8lgQgcWDXC7aqN08fl96MfFVQrvNKxFs5W1or UrgZZUTnLlv1qEoi+0G/8OJA5MXKNnVjPy6KR1Ecsw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudeguddgheduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredt tddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeg geegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiih ii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 3 Feb 2023 21:47:24 -0500 (EST) Date: Sat, 4 Feb 2023 11:47:16 +0900 From: Michael Paquier To: Nathan Bossart Cc: Andres Freund , Tom Lane , Robert Haas , Thomas Munro , Fujii Masao , Postgres hackers Subject: Re: Weird failure with latches in curculio on v15 Message-ID: References: <20230201165801.33ydbxvjdbomjqa7@alap3.anarazel.de> <20230201172016.7c3tg2omorvyxw6h@alap3.anarazel.de> <1384520.1675272439@sss.pgh.pa.us> <20230201181827.5pcnqdnt3nlcjgex@alap3.anarazel.de> <20230203071557.ofq56vmuxx5jgbey@alap3.anarazel.de> <1645348.1675409043@sss.pgh.pa.us> <20230203074422.wx2ysoraqh46zqg2@alap3.anarazel.de> <20230203185417.GA243728@nathanxps13> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="pWI9Ezzpf7RpARwL" Content-Disposition: inline In-Reply-To: <20230203185417.GA243728@nathanxps13> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --pWI9Ezzpf7RpARwL Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Feb 03, 2023 at 10:54:17AM -0800, Nathan Bossart wrote: > 0001 is just v1-0001 from upthread. This moves Pre/PostRestoreCommand to > surround only the call to system(). I think this should get us closer to > pre-v15 behavior. + if (exitOnSigterm) + PreRestoreCommand(); + rc = system(command); + + if (exitOnSigterm) + PostRestoreCommand(); I don't really want to let that hanging around on HEAD much longer, so I'm OK to do that for HEAD, then figure out what needs to be done for the older issue at hand. + /* + * PreRestoreCommand() is used to tell the SIGTERM handler for the startup + * process that it is okay to proc_exit() right away on SIGTERM. This is + * done for the duration of the system() call because there isn't a good + * way to break out while it is executing. Since we might call proc_exit() + * in a signal handler here, it is extremely important that nothing but the + * system() call happens between the calls to PreRestoreCommand() and + * PostRestoreCommand(). Any additional code must go before or after this + * section. + */ Still, it seems to me that the large comment block in shell_restore() ought to be moved to ExecuteRecoveryCommand(), no? The assumptions under which one can use exitOnSigterm and failOnSignal could be completed in the header of the function based on that. -- Michael --pWI9Ezzpf7RpARwL Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmPdxzQACgkQnvQgOdby QH1UzBAAhSKTmnSJAkGgHdHStHkoqDhsTTWzZQ6cgBA+kQjqhrV9/kxezPKdUwcI PpRHykS74RANUOjFv+wvKkbWj/rTfJocSxq3Rk23dFvrHy3oKO8CNzfLDVNDS7XS cQBwAHUSdadD2dXIQadvi/ebtSmo26/Zij5PCFhL4BhE0aBmi4p0GtEJBTCuD1Ve d85MM189rRdmAvSxH1ET13ogoVlKzddDRvmYBZhnth6gUlKko+fmv1sdUFKRe+Ir m2m3jceMXNaq2ylkaYsROYhn4/Pe0vyaBku5XOwUh47+goYmBCtWTUSBOtxpzsro KsBtXZcftRri6TkrmWn1gKn0xooLHgji+BJ46cNtVtUTVYhaS9c54G86ZJk8KuPX Sktl1BLqtW1zZI3XYWFiGyuVcTU8AnwQ8BpT/jbNxCn7Q+wwksFtlF1iMExrwgoF 8GqccBTcWI9TJlpV4xVkJXOti1df80QKD7uk3d+z1YBntDM38oyjM+wdyOyr6/4e rpHMZJi62zGXKohBhNAJtw6/MADj0wffEPG14lU1hn0EEDxKAuc0/H5sXXrPOp4u vz6qomwBZmGrwbkU9VmLwmdp0GoI0x+G87wp5rT0FnK2tPep1JkGRh256QsdZ5ii CxurciUvqV85/nwahRKiFqanwVIs/Z0/u4T/SjC9ZhvHVzhXeVs= =mezB -----END PGP SIGNATURE----- --pWI9Ezzpf7RpARwL--