| From: | Koshino Taiki <koshino(at)sraoss(dot)co(dot)jp> |
|---|---|
| To: | "pgpool-hackers(at)lists(dot)postgresql(dot)org" <pgpool-hackers(at)lists(dot)postgresql(dot)org> |
| Cc: | Emond Papegaaij <emond(dot)papegaaij(at)gmail(dot)com> |
| Subject: | Convert close_idle_connection (SIGUSR1) to flag-only handler with main-loop processing. |
| Date: | 2026-07-21 06:01:46 |
| Message-ID: | TY4PR01MB1737480CA247F6CCBD87C958694C22@TY4PR01MB17374.jpnprd01.prod.outlook.com |
| 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.
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/
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Convert-close_idle_connection-SIGUSR1-to-flag-onl.patch | application/octet-stream | 4.6 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tatsuo Ishii | 2026-07-21 12:02:26 | Re: Adding volatile qualifer |
| Previous Message | Koshino Taiki | 2026-07-21 05:59:11 | Fix unsigned underflow in inject_cached_message |