Re: Fix signal handler in pgpool main

From: Emond Papegaaij <emond(dot)papegaaij(at)gmail(dot)com>
To: Tatsuo Ishii <ishii(at)postgresql(dot)org>
Cc: pgpool-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Fix signal handler in pgpool main
Date: 2026-06-24 13:19:10
Message-ID: CAGXsc+buSf4=WPyVZP-VNHOSABBeRGx17sQjdu-9LyPY3FXBvA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgpool-hackers

Thank you for taking care of this! I agree with your decision to not
patch 4.3 given that the code doesn't match. You have to weigh the
benefits against the risks in such cases.

Best regards,
Emond

Op di 23 jun 2026 om 14:54 schreef Tatsuo Ishii <ishii(at)postgresql(dot)org>:

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

In response to

Browse pgpool-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2026-06-25 06:14:28 Removing support for FE/BE protocol version 2
Previous Message Tatsuo Ishii 2026-06-23 12:54:23 Re: Fix signal handler in pgpool main