agora inbox for pgpool-committers@postgresql.org
help / color / mirror / Atom feedFrom: Taiki Koshino <koshino@sraoss.co.jp>
To: pgpool-committers@lists.postgresql.org
Subject: pgpool: Convert close_idle_connection (SIGUSR1) to flag-only handler wi
Date: Wed, 16 Sep 2026 08:47:15 +0000
Message-ID: <E1x6lIR-0000000CuSc-28SR@gothos.postgresql.org> (raw)
Convert close_idle_connection (SIGUSR1) to flag-only handler with main-loop processing.
The SIGUSR1 handler in the child process directly performed connection
cleanup, including pool_free_startup_packet() and pool_close(). These
operations are not async-signal-safe and can modify connection pool memory
while the main loop is using it.
In particular, SIGUSR1 can arrive while
connect_using_existing_connection() is replacing startup packet pointers.
This can cause the signal handler to free the same startup packet or
connection pool that the main loop is currently accessing.
This issue was reproduced in a local test environment, where sending
SIGUSR1 during startup packet replacement caused the child process to
terminate with a segmentation fault.
Changes:
Flag-only Signal Handler: Make close_idle_connection() only set a
volatile sig_atomic_t flag and return.
Main-loop Processing: Process the pending request from the child main loop
and perform connection cleanup outside the signal handler.
Direct Cleanup: Update the failover/failback restart path to call the
cleanup function directly.
Reported-by: Emond Papegaaij <emond.papegaaij@gmail.com>
Reported-by: Claude code
Author: Taiki Koshino <koshino@sraoss.co.jp>
Discussion: https://www.postgresql.org/message-id/TY4PR01MB1737480CA247F6CCBD87C958694C22%40TY4PR01MB17374.jpnpr...
Backpatch-through: v4.3
Branch
------
V4_5_STABLE
Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=0a80f5346a420b08a738a45ed8ed7b1428ee4...
Modified Files
--------------
src/protocol/child.c | 46 +++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 41 insertions(+), 5 deletions(-)
view thread (6+ messages) latest in thread
Message-ID: <E1x6lIR-0000000CuSc-28SR@gothos.postgresql.org>
Permalink: ../E1x6lIR-0000000CuSc-28SR@gothos.postgresql.org/
Also on: postgresql.org/message-id/E1x6lIR-0000000CuSc-28SR@gothos.postgresql.org
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgpool-committers@postgresql.org
Cc: koshino@sraoss.co.jp, pgpool-committers@lists.postgresql.org
Subject: Re: pgpool: Convert close_idle_connection (SIGUSR1) to flag-only handler wi
In-Reply-To: <E1x6lIR-0000000CuSc-28SR@gothos.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox