agora inbox for pgpool-committers@postgresql.org  
help / color / mirror / Atom feed
pgpool: Convert pcp_worker die handler to flag-only.
6+ messages / 1 participants
[nested] [flat]

* pgpool: Convert pcp_worker die handler to flag-only.
@ 2026-09-16 09:23 Taiki Koshino <koshino@sraoss.co.jp>
  0 siblings, 0 replies; 6+ messages in thread

From: Taiki Koshino @ 2026-09-16 09:23 UTC (permalink / raw)
  To: pgpool-committers@lists.postgresql.org

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(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgpool: Convert pcp_worker die handler to flag-only.
@ 2026-09-16 09:24 Taiki Koshino <koshino@sraoss.co.jp>
  0 siblings, 0 replies; 6+ messages in thread

From: Taiki Koshino @ 2026-09-16 09:24 UTC (permalink / raw)
  To: pgpool-committers@lists.postgresql.org

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
------
V4_7_STABLE

Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=f4b9595ad101502f8284b9a257b318fabdbdc...

Modified Files
--------------
src/pcp_con/pcp_worker.c | 53 ++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 44 insertions(+), 9 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgpool: Convert pcp_worker die handler to flag-only.
@ 2026-09-16 09:24 Taiki Koshino <koshino@sraoss.co.jp>
  0 siblings, 0 replies; 6+ messages in thread

From: Taiki Koshino @ 2026-09-16 09:24 UTC (permalink / raw)
  To: pgpool-committers@lists.postgresql.org

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
------
V4_6_STABLE

Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=102c682923b30fa28d8c42d07ea990bb63125...

Modified Files
--------------
src/pcp_con/pcp_worker.c | 53 ++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 44 insertions(+), 9 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgpool: Convert pcp_worker die handler to flag-only.
@ 2026-09-16 09:24 Taiki Koshino <koshino@sraoss.co.jp>
  0 siblings, 0 replies; 6+ messages in thread

From: Taiki Koshino @ 2026-09-16 09:24 UTC (permalink / raw)
  To: pgpool-committers@lists.postgresql.org

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
------
V4_5_STABLE

Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=3347e0970758f033de0e63a032172ffc5bf0d...

Modified Files
--------------
src/pcp_con/pcp_worker.c | 53 ++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 44 insertions(+), 9 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgpool: Convert pcp_worker die handler to flag-only.
@ 2026-09-16 09:25 Taiki Koshino <koshino@sraoss.co.jp>
  0 siblings, 0 replies; 6+ messages in thread

From: Taiki Koshino @ 2026-09-16 09:25 UTC (permalink / raw)
  To: pgpool-committers@lists.postgresql.org

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
------
V4_4_STABLE

Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=ac6a7bf08f1aec0abfce222cae6d475b0da4e...

Modified Files
--------------
src/pcp_con/pcp_worker.c | 53 ++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 44 insertions(+), 9 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgpool: Convert pcp_worker die handler to flag-only.
@ 2026-09-16 09:25 Taiki Koshino <koshino@sraoss.co.jp>
  0 siblings, 0 replies; 6+ messages in thread

From: Taiki Koshino @ 2026-09-16 09:25 UTC (permalink / raw)
  To: pgpool-committers@lists.postgresql.org

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
------
V4_3_STABLE

Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=8964c11f5691d1237d4ec4bd32ec0a295be4f...

Modified Files
--------------
src/pcp_con/pcp_worker.c | 53 ++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 44 insertions(+), 9 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2026-09-16 09:25 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-09-16 09:23 pgpool: Convert pcp_worker die handler to flag-only. Taiki Koshino <koshino@sraoss.co.jp>
2026-09-16 09:24 pgpool: Convert pcp_worker die handler to flag-only. Taiki Koshino <koshino@sraoss.co.jp>
2026-09-16 09:24 pgpool: Convert pcp_worker die handler to flag-only. Taiki Koshino <koshino@sraoss.co.jp>
2026-09-16 09:24 pgpool: Convert pcp_worker die handler to flag-only. Taiki Koshino <koshino@sraoss.co.jp>
2026-09-16 09:25 pgpool: Convert pcp_worker die handler to flag-only. Taiki Koshino <koshino@sraoss.co.jp>
2026-09-16 09:25 pgpool: Convert pcp_worker die handler to flag-only. Taiki Koshino <koshino@sraoss.co.jp>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox