| From: | Tatsuo Ishii <ishii(at)postgresql(dot)org> |
|---|---|
| To: | koshino(at)sraoss(dot)co(dot)jp |
| Cc: | pgpool-hackers(at)lists(dot)postgresql(dot)org, emond(dot)papegaaij(at)gmail(dot)com |
| Subject: | Re: Convert close_idle_connection (SIGUSR1) to flag-only handler with main-loop processing. |
| Date: | 2026-08-17 06:27:37 |
| Message-ID: | 20260817.152737.415963151986264443.ishii@postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgpool-hackers |
> 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tatsuo Ishii | 2026-08-17 09:31:10 | Fixing pool_read2 |
| Previous Message | Tatsuo Ishii | 2026-08-17 06:24:32 | Re: Delimit query-cache key to prevent collisions |