| From: | Tatsuo Ishii <ishii(at)postgresql(dot)org> |
|---|---|
| To: | emond(dot)papegaaij(at)gmail(dot)com |
| Cc: | pgpool-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Fix signal handler in pgpool main |
| Date: | 2026-06-23 12:54:23 |
| Message-ID: | 20260623.215423.1556575793364415842.ishii@postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgpool-hackers |
Hi Emond,
> I got a bug report regarding pgpool main process from Emond Papegaaij:
> its exit/reload signal handler uses non signal safe functions, and it
> could lead to a crash of the process.
>
> Attached is the patch from him generated by Claude Code, with slight
> modifications by me.
>
> Basically it changes the signal handler to async-signal-safe calls
> only: capture the signal number into a new volatile sig_atomic_t
> main_exit_request, write one byte to the existing self-pipe to wake
> the main loop, restore errno, and return. The actual shutdown is
> performed synchronously by a new do_shutdown() function called from
> the pgpol main loop at the top of every iteration (via
> check_requests()) and also right after the inner pool_pause() returns,
> so a signal arriving during the 2-second select() sleep is acted on
> without an extra tick of latency.
>
> I think this patch is important and worth to apply to all supported
> branches.
>
> However, since it touches one of the most critical part of pgpool, I
> would like to apply to master branch first and see how our build-farm
> acts before back patching (it will take a few days).
>
> Comments?
Patch pushed to v4.4.
Peng and Koshino reviewed the patch off-list. No change was necessary.
I just removed some non-ASCII characters in comments (probably I
mistakenly brought them in by copy-and-paste). I tried to back-patch
to v4.3 but it seems it needs invasive changes and I gave up it. So I
decided to back patch through v4.4.
Thank you!
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Emond Papegaaij | 2026-06-24 13:19:10 | Re: Fix signal handler in pgpool main |
| Previous Message | Tatsuo Ishii | 2026-06-23 11:38:48 | Re: Proposal: Recent mutated table tracking in memory |