| From: | Koshino Taiki <koshino(at)sraoss(dot)co(dot)jp> |
|---|---|
| To: | Tatsuo Ishii <ishii(at)postgresql(dot)org> |
| Cc: | "pgpool-hackers(at)lists(dot)postgresql(dot)org" <pgpool-hackers(at)lists(dot)postgresql(dot)org>, "emond(dot)papegaaij(at)gmail(dot)com" <emond(dot)papegaaij(at)gmail(dot)com> |
| Subject: | Re: Convert pcp_exit_handler and wakeup_handler_parent to flag-only. |
| Date: | 2026-09-01 07:27:42 |
| Message-ID: | OS9P286MB6486AE6F3EAF73BDE1151EA094A82@OS9P286MB6486.JPNP286.PROD.OUTLOOK.COM |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgpool-hackers |
> I skimmed related source file (wd_lifecheck.c) and found following
> loop in lifecheck_exit_handler(after patch renamed to
> process_lifecheck_exit_request):
>
> do
> {
> wpid = wait(NULL);
> } while (wpid > 0 || (wpid == -1 && errno == EINTR));
>
> I think this loop could wait forever if one of child process won't
> respond to the kill signal. Is it possible for you to confirm this?
The wait() loop may block indefinitely in general, but it does not seem
to be the cause of this timeout.
The backtrace showed that the lifecheck process had not yet reached the
new process_lifecheck_exit_request() call in the watchdog loop. It was
still sleeping in the readiness loop:
#0 clock_nanosleep()
#1 nanosleep()
#2 sleep()
#3 lifecheck_main() at wd_lifecheck.c:472
Before this patch, the signal handler performed the shutdown immediately,
including exit(), so the process could terminate from inside an
initialization loop. After the handler was changed to only set a flag,
the process continued waiting because the flag was checked only in the
later watchdog loop.
A similar issue could potentially occur in the earlier loop that gets
the list of watchdog nodes. For completeness, I added
process_lifecheck_exit_request() checks to both initialization loops.
I tested the updated 028 patch together with patches 026, 027 and 029,
and confirmed that all regression tests pass.
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/
________________________________
差出人: Tatsuo Ishii <ishii(at)postgresql(dot)org>
送信日時: 2026年8月27日 15:59
宛先: Koshino Taiki <koshino(at)sraoss(dot)co(dot)jp>
CC: pgpool-hackers(at)lists(dot)postgresql(dot)org <pgpool-hackers(at)lists(dot)postgresql(dot)org>; emond(dot)papegaaij(at)gmail(dot)com <emond(dot)papegaaij(at)gmail(dot)com>
件名: Re: Convert pcp_exit_handler and wakeup_handler_parent to 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.
I skimmed related source file (wd_lifecheck.c) and found following
loop in lifecheck_exit_handler(after patch renamed to
process_lifecheck_exit_request):
do
{
wpid = wait(NULL);
} while (wpid > 0 || (wpid == -1 && errno == EINTR));
I think this loop could wait forever if one of child process won't
respond to the kill signal. Is it possible for you to confirm this?
Regards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
| Attachment | Content-Type | Size |
|---|---|---|
| v2-0001-Convert-lifecheck_exit_handler-to-flag-only.patch | application/octet-stream | 3.6 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Koshino Taiki | 2026-09-02 00:15:03 | Report replication delay as unknown for down standby nodes |
| Previous Message | Tatsuo Ishii | 2026-08-27 06:59:58 | Re: Convert pcp_exit_handler and wakeup_handler_parent to flag-only. |