| 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 close_idle_connection (SIGUSR1) to flag-only handler with main-loop processing. |
| Date: | 2026-09-03 04:56:45 |
| Message-ID: | OS9P286MB648603F150A761E9D0A9E21094B62@OS9P286MB6486.JPNP286.PROD.OUTLOOK.COM |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgpool-hackers |
> I have looked in the patch. It looks good to me.
Thank you for reviewing the patch.
I have prepared an updated patch with the Discussion: field filled in.
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月17日 15:27
宛先: 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 close_idle_connection (SIGUSR1) to flag-only handler with main-loop processing.
> I have reviewed the patch(026-close-idle-connection-flag-only) from Emond.
> It has also passed all regression tests.
>
> The SIGUSR1 handler in the child process directly performed connection
> cleanup, including pool_free_startup_packet() and pool_close(). These
> operations are not async-signal-safe and can modify connection pool memory
> while the main loop is using it.
>
> In particular, SIGUSR1 can arrive while
> connect_using_existing_connection() is replacing startup packet pointers.
> This can cause the signal handler to free the same startup packet or
> connection pool that the main loop is currently accessing.
>
> This issue was reproduced in a local test environment, where sending
> SIGUSR1 during startup packet replacement caused the child process to
> terminate with a segmentation fault.
>
> Changes:
> Flag-only Signal Handler: Make close_idle_connection() only set a
> volatile sig_atomic_t flag and return.
>
> Main-loop Processing: Process the pending request from the child main loop
> and perform connection cleanup outside the signal handler.
>
> Direct Cleanup: Update the failover/failback restart path to call the
> cleanup function directly.
>
> Thank you Emond.
I have looked in the patch. It looks good to me.
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-close_idle_connection-SIGUSR1-to-flag-onl.patch | application/octet-stream | 4.7 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Koshino Taiki | 2026-09-03 05:29:40 | Re: Convert pcp_exit_handler and wakeup_handler_parent to flag-only. |
| Previous Message | Koshino Taiki | 2026-09-03 04:50:16 | Re: Fix unsigned underflow in inject_cached_message |