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 pcp_worker die handler to flag-only.
Date: Wed, 16 Sep 2026 09:23:33 +0000
Message-ID: <E1x6lrZ-0000000DBtn-0UyD@gothos.postgresql.org> (raw)
Convert pcp_worker die handler to flag-only.
die() (SIGTERM/SIGINT/SIGQUIT handler in the PCP worker child) directly
called ereport() and proceeded to exit logic from signal context. These
operations are not async-signal-safe, and ereport() in particular can
allocate memory or acquire locks that the main loop may already be
holding, risking corruption or a hang if the signal arrives at the
wrong point.
Convert die() to the canonical pgpool flag-only pattern used elsewhere
in this file. die() now only saves errno, records the signal number
into pcp_worker_shutdown_signal, sets pcp_worker_shutdown_request, and
restores errno before returning. The actual handling, logging the
shutdown request and performing the SIGTERM "smart shutdown" or
SIGINT/SIGQUIT immediate exit, is moved into the new
process_pcp_worker_shutdown_request(), which is called from the main
loop at safe points (before and after each PCP packet read).
Reported-by: Emond Papegaaij
Reported-by: Claude code
Author: Taiki Koshino <koshino@sraoss.co.jp>
Discussion: https://www.postgresql.org/message-id/OS9P286MB6486805F1222F8F50767639094AE2%40OS9P286MB6486.JPNP286...
Backpatch-through: v4.3
Branch
------
master
Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=0f1e7b87c52a602b1db55835606dc9047321a...
Modified Files
--------------
src/pcp_con/pcp_worker.c | 53 ++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 44 insertions(+), 9 deletions(-)
view thread (6+ messages) latest in thread
Message-ID: <E1x6lrZ-0000000DBtn-0UyD@gothos.postgresql.org>
Permalink: ../E1x6lrZ-0000000DBtn-0UyD@gothos.postgresql.org/
Also on: postgresql.org/message-id/E1x6lrZ-0000000DBtn-0UyD@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 pcp_worker die handler to flag-only.
In-Reply-To: <E1x6lrZ-0000000DBtn-0UyD@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