| From: | Koshino Taiki <koshino(at)sraoss(dot)co(dot)jp> |
|---|---|
| To: | "pgpool-hackers(at)lists(dot)postgresql(dot)org" <pgpool-hackers(at)lists(dot)postgresql(dot)org> |
| Cc: | Emond Papegaaij <emond(dot)papegaaij(at)gmail(dot)com> |
| Subject: | Re: Convert pcp_worker die handler to flag-only. |
| Date: | 2026-09-03 05:37:03 |
| Message-ID: | OS9P286MB6486EF75BB564050B637D24B94B62@OS9P286MB6486.JPNP286.PROD.OUTLOOK.COM |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgpool-hackers |
Sorry for the additional update.
I have attached a revised patch with the
Discussion: field filled in.
The implementation itself has not changed.
Best Regards,
Taiki Koshino<koshino(at)sraoss(dot)co(dot)jp>
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/
________________________________
差出人: Koshino Taiki <koshino(at)sraoss(dot)co(dot)jp>
送信日時: 2026年8月26日 18:21
宛先: pgpool-hackers(at)lists(dot)postgresql(dot)org <pgpool-hackers(at)lists(dot)postgresql(dot)org>
CC: Emond Papegaaij <emond(dot)papegaaij(at)gmail(dot)com>
件名: Convert pcp_worker die handler to flag-only.
I have reviewed the patch(029-pcp-worker-die-flag-only) from Emond.
It has also passed all regression tests.
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).
Note that in the originally provided patch, the signal was tracked with a single flag,
pcp_worker_shutdown_request, holding the signal number directly.
To align with 026-close-idle-connection-flag-only and 027-pcp-exit-handler-flag-only,
which keep the variable indicating that a signal has arrived separate
from the variable storing which signal it was, I split this into two variables here as well.
For reference, I'm also attaching the original patch(0001-fix-pcp-worker-die-flag-only.patch).
Also, regression tests passed after applying this together with the other
similar signal handler fixes, 026-close-idle-connection-flag-only and 027-pcp-exit-handler-flag-only.
However, 028-lifecheck-exit-handler-flag-only is failing due to a timeout
in the 004.watchdog test case, so 028 has not been posted to this ML yet.
Thank you Emond.
Taiki Koshino<koshino(at)sraoss(dot)co(dot)jp>
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/
| Attachment | Content-Type | Size |
|---|---|---|
| v2-0001-Convert-pcp_worker-die-handler-to-flag-only.patch | application/octet-stream | 4.5 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Nadav Shatz | 2026-09-03 06:01:13 | Re: Report replication delay as unknown for down standby nodes |
| Previous Message | Koshino Taiki | 2026-09-03 05:29:40 | Re: Convert pcp_exit_handler and wakeup_handler_parent to flag-only. |