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 1wAa0E-0006cB-2y for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Apr 2026 20:59:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wAa0D-0026VY-0T for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Apr 2026 20:59:58 +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 1wAa0C-0026VN-2Q for pgsql-hackers@lists.postgresql.org; Wed, 08 Apr 2026 20:59:57 +0000 Received: from smtp.outgoing.loopia.se ([93.188.3.37]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wAa0B-0000000048o-12J1 for pgsql-hackers@postgresql.org; Wed, 08 Apr 2026 20:59:57 +0000 Received: from s807.loopia.se (localhost [127.0.0.1]) by s807.loopia.se (Postfix) with ESMTP id C613B57F4DE for ; Wed, 08 Apr 2026 22:59:53 +0200 (CEST) Received: from s979.loopia.se (unknown [172.22.191.6]) by s807.loopia.se (Postfix) with ESMTP id B291057FFF8; Wed, 08 Apr 2026 22:59:53 +0200 (CEST) Received: from localhost (unknown [172.22.191.5]) by s979.loopia.se (Postfix) with ESMTP id B133310BC430; Wed, 08 Apr 2026 22:59:53 +0200 (CEST) X-Virus-Scanned: amavis at amavis.loopia.se X-Spam-Flag: NO X-Spam-Score: -1.2 X-Spam-Level: X-Spam-Status: No, score=-1.2 tagged_above=-999 required=6.2 tests=[ALL_TRUSTED=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1] autolearn=disabled Authentication-Results: s471.loopia.se (amavis); dkim=pass (2048-bit key) header.d=proxel.se Received: from s979.loopia.se ([172.22.191.6]) by localhost (s471.loopia.se [172.22.190.35]) (amavis, port 10024) with LMTP id X1p3gwXpUA7g; Wed, 8 Apr 2026 22:59:53 +0200 (CEST) X-Loopia-Auth: user X-Loopia-User: andreas@proxel.se X-Loopia-Originating-IP: 147.28.75.140 Received: from [192.168.0.121] (customer-147-28-75-140.stosn.net [147.28.75.140]) (Authenticated sender: andreas@proxel.se) by s979.loopia.se (Postfix) with ESMTPSA id 3599B10BC416; Wed, 08 Apr 2026 22:59:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proxel.se; s=loopiadkim1707418970; t=1775681993; bh=LnceDZnmw+hy/JMmH0uUCaaQ9xWSickj0uLMaue3FSw=; h=Date:Subject:To:References:From:In-Reply-To; b=VQFsJeMF29IZ6IfFAcrNzSW08TfdZLxFSSFHVu9nZVDz77gztmyoXEqt4QfIeMpHv NydXv9Xa7b8pwFSOYdAk3Jx3joWAc54MFxIf/cbvnDxFfBFwc76YeLdCTp/pVvXJ1e pMkoLdiqFsCFL/5o9B0nWXmd89/G66g95x32fvZs3J3Ek04ItYn0mdEBl04KYr6Hlj 87swFdaFCwiyPGUh2LrIuTA0RY8ZlqUEeTbssvRJlsN0gNQs0E5QawZ4nA/oBOso55 u+ULrEwII6zlRake1itChV9csG7ztP5LzLqSmMiAEETd763Qdorg6muib2UOacWqsy A7DTyl0xoDBrg== Message-ID: <6a42c40e-eb81-4212-9bca-8c0eb02d47d1@proxel.se> Date: Wed, 8 Apr 2026 22:59:52 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Use proc_exit() in WalRcvWaitForStartPosition To: Chao Li , PostgreSQL-development References: <74381238-4E8A-4621-B794-57025DCCE0BA@gmail.com> From: Andreas Karlsson Content-Language: en-US In-Reply-To: <74381238-4E8A-4621-B794-57025DCCE0BA@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 4/8/26 11:08 AM, Chao Li wrote: > While working on another patch, I happened to notice that WalRcvWaitForStartPosition() calls raw exit(1). I think this should use proc_exit(1) instead, so that the normal cleanup machinery is not bypassed. > > This tiny patch just replaces exit(1) with proc_exit(1) in WalRcvWaitForStartPosition(). This looks likely to be correct since when we exit in WalReceiverMain() (on WALRCV_STOPPING and WALRCV_STOPPED) we call proc_exit(1). I feel we should exit the same way in WalRcvWaitForStartPosition() as we do in WalReceiverMain() and if not I would like a comment explaining why those two cases are different. Andreas