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 1wc0eH-0031EL-32 for pgpool-hackers@arkaria.postgresql.org; Tue, 23 Jun 2026 12:54:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wc0eG-00Bs0z-2w for pgpool-hackers@arkaria.postgresql.org; Tue, 23 Jun 2026 12:54:40 +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.96) (envelope-from ) id 1wc0eG-00Bs0s-2Q for pgpool-hackers@lists.postgresql.org; Tue, 23 Jun 2026 12:54:40 +0000 Received: from meldrar.postgresql.org ([2a02:c0:301:0:ffff::31]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wc0eE-00000001kKo-0us6 for pgpool-hackers@lists.postgresql.org; Tue, 23 Jun 2026 12:54:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Content-Transfer-Encoding:Content-Type: Mime-Version:References:In-Reply-To:From:Subject:Cc:To:Message-Id:Date:Sender :Reply-To:Content-ID:Content-Description; bh=krcTHR8Ma4lUjfgAdfr+TIjbpiaf41pWzzZzTcPz8xg=; b=r75+hW2DfdobmEXhg3v8Vs8qC/ vylfejQ4qI0NjR8KN8JZL//koZPF7xqycRWN/vNEu+jJwqF5NPNMeTed+xOFVGR/P2mHzy6JGO9+V cMG1ZUa7Bd37w7MScMgPRrXKrsYRLY6N+/M0jzPaYsbbufOaNCFymnY2KlhSn6JUnVXLtm+vKpv0a y5a7PqTmHNZh4O5QvtWpWzd5fnbtU4tx4gboNRXAdkISrd3aM4niBhEfsPYWeSRhz/7iGIII3KEDW l74YMCaJCLhsc0yJF4el6obcvOF3LOWiMA3Z/u7XYFTs71OBK6D/JqHB/D9iRLl7gr7nHwnvh4o+4 kt7TfwgA==; Received: from [2409:11:4120:300:d75a:66c6:95a6:4204] (helo=localhost) by meldrar.postgresql.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wc0eA-0055AV-0B; Tue, 23 Jun 2026 12:54:36 +0000 Date: Tue, 23 Jun 2026 21:54:23 +0900 (JST) Message-Id: <20260623.215423.1556575793364415842.ishii@postgresql.org> To: emond.papegaaij@gmail.com Cc: pgpool-hackers@lists.postgresql.org Subject: Re: Fix signal handler in pgpool main From: Tatsuo Ishii In-Reply-To: <20260608.103312.126925225500634683.ishii@postgresql.org> References: <20260608.103312.126925225500634683.ishii@postgresql.org> X-Mailer: Mew version 6.8 on Emacs 29.3 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2409:11:4120:300:d75a:66c6:95a6:4204 (failed) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Emond, > I got a bug report regarding pgpool main process from Emond Papegaaij: > its exit/reload signal handler uses non signal safe functions, and it > could lead to a crash of the process. > > Attached is the patch from him generated by Claude Code, with slight > modifications by me. > > Basically it changes the signal handler to async-signal-safe calls > only: capture the signal number into a new volatile sig_atomic_t > main_exit_request, write one byte to the existing self-pipe to wake > the main loop, restore errno, and return. The actual shutdown is > performed synchronously by a new do_shutdown() function called from > the pgpol main loop at the top of every iteration (via > check_requests()) and also right after the inner pool_pause() returns, > so a signal arriving during the 2-second select() sleep is acted on > without an extra tick of latency. > > I think this patch is important and worth to apply to all supported > branches. > > However, since it touches one of the most critical part of pgpool, I > would like to apply to master branch first and see how our build-farm > acts before back patching (it will take a few days). > > Comments? Patch pushed to v4.4. Peng and Koshino reviewed the patch off-list. No change was necessary. I just removed some non-ASCII characters in comments (probably I mistakenly brought them in by copy-and-paste). I tried to back-patch to v4.3 but it seems it needs invasive changes and I gave up it. So I decided to back patch through v4.4. Thank you! -- Tatsuo Ishii SRA OSS K.K. English: http://www.sraoss.co.jp/index_en/ Japanese:http://www.sraoss.co.jp