| From: | Taiki Koshino <koshino(at)sraoss(dot)co(dot)jp> |
|---|---|
| To: | pgpool-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgpool: Convert pcp_worker die handler to flag-only. |
| Date: | 2026-09-16 09:25:10 |
| Message-ID: | E1x6lt8-0000000DCp7-1zD4@gothos.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgpool-committers |
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(at)sraoss(dot)co(dot)jp>
Discussion: https://www.postgresql.org/message-id/OS9P286MB6486805F1222F8F50767639094AE2%40OS9P286MB6486.JPNP286.PROD.OUTLOOK.COM
Backpatch-through: v4.3
Branch
------
V4_4_STABLE
Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=ac6a7bf08f1aec0abfce222cae6d475b0da4e907
Modified Files
--------------
src/pcp_con/pcp_worker.c | 53 ++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 44 insertions(+), 9 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Taiki Koshino | 2026-09-16 09:25:41 | pgpool: Convert pcp_worker die handler to flag-only. |
| Previous Message | Taiki Koshino | 2026-09-16 09:24:48 | pgpool: Convert pcp_worker die handler to flag-only. |