agora inbox for pgpool-committers@postgresql.org  
help / color / mirror / Atom feed
pgpool: Convert close_idle_connection (SIGUSR1) to flag-only handler wi
6+ messages / 1 participants
[nested] [flat]

* pgpool: Convert close_idle_connection (SIGUSR1) to flag-only handler wi
@ 2026-09-16 08:46 Taiki Koshino <koshino@sraoss.co.jp>
  0 siblings, 0 replies; 6+ messages in thread

From: Taiki Koshino @ 2026-09-16 08:46 UTC (permalink / raw)
  To: pgpool-committers@lists.postgresql.org

Convert close_idle_connection (SIGUSR1) to flag-only handler with main-loop processing.

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.

Reported-by: Emond Papegaaij <emond.papegaaij@gmail.com>
Reported-by: Claude code
Author: Taiki Koshino <koshino@sraoss.co.jp>
Discussion: https://www.postgresql.org/message-id/TY4PR01MB1737480CA247F6CCBD87C958694C22%40TY4PR01MB17374.jpnpr...
Backpatch-through: v4.3

Branch
------
master

Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=0dbc7409fb854c392f11723ae48ef5c3b5743...

Modified Files
--------------
src/protocol/child.c | 46 +++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 41 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgpool: Convert close_idle_connection (SIGUSR1) to flag-only handler wi
@ 2026-09-16 08:46 Taiki Koshino <koshino@sraoss.co.jp>
  0 siblings, 0 replies; 6+ messages in thread

From: Taiki Koshino @ 2026-09-16 08:46 UTC (permalink / raw)
  To: pgpool-committers@lists.postgresql.org

Convert close_idle_connection (SIGUSR1) to flag-only handler with main-loop processing.

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.

Reported-by: Emond Papegaaij <emond.papegaaij@gmail.com>
Reported-by: Claude code
Author: Taiki Koshino <koshino@sraoss.co.jp>
Discussion: https://www.postgresql.org/message-id/TY4PR01MB1737480CA247F6CCBD87C958694C22%40TY4PR01MB17374.jpnpr...
Backpatch-through: v4.3

Branch
------
V4_7_STABLE

Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=47c4735e827200fd10de45caf7aab95769837...

Modified Files
--------------
src/protocol/child.c | 46 +++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 41 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgpool: Convert close_idle_connection (SIGUSR1) to flag-only handler wi
@ 2026-09-16 08:46 Taiki Koshino <koshino@sraoss.co.jp>
  0 siblings, 0 replies; 6+ messages in thread

From: Taiki Koshino @ 2026-09-16 08:46 UTC (permalink / raw)
  To: pgpool-committers@lists.postgresql.org

Convert close_idle_connection (SIGUSR1) to flag-only handler with main-loop processing.

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.

Reported-by: Emond Papegaaij <emond.papegaaij@gmail.com>
Reported-by: Claude code
Author: Taiki Koshino <koshino@sraoss.co.jp>
Discussion: https://www.postgresql.org/message-id/TY4PR01MB1737480CA247F6CCBD87C958694C22%40TY4PR01MB17374.jpnpr...
Backpatch-through: v4.3

Branch
------
V4_6_STABLE

Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=1e6eedf2ed9956fb88508eb58b0a75ca39eec...

Modified Files
--------------
src/protocol/child.c | 46 +++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 41 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgpool: Convert close_idle_connection (SIGUSR1) to flag-only handler wi
@ 2026-09-16 08:47 Taiki Koshino <koshino@sraoss.co.jp>
  0 siblings, 0 replies; 6+ messages in thread

From: Taiki Koshino @ 2026-09-16 08:47 UTC (permalink / raw)
  To: pgpool-committers@lists.postgresql.org

Convert close_idle_connection (SIGUSR1) to flag-only handler with main-loop processing.

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.

Reported-by: Emond Papegaaij <emond.papegaaij@gmail.com>
Reported-by: Claude code
Author: Taiki Koshino <koshino@sraoss.co.jp>
Discussion: https://www.postgresql.org/message-id/TY4PR01MB1737480CA247F6CCBD87C958694C22%40TY4PR01MB17374.jpnpr...
Backpatch-through: v4.3

Branch
------
V4_5_STABLE

Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=0a80f5346a420b08a738a45ed8ed7b1428ee4...

Modified Files
--------------
src/protocol/child.c | 46 +++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 41 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgpool: Convert close_idle_connection (SIGUSR1) to flag-only handler wi
@ 2026-09-16 08:47 Taiki Koshino <koshino@sraoss.co.jp>
  0 siblings, 0 replies; 6+ messages in thread

From: Taiki Koshino @ 2026-09-16 08:47 UTC (permalink / raw)
  To: pgpool-committers@lists.postgresql.org

Convert close_idle_connection (SIGUSR1) to flag-only handler with main-loop processing.

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.

Reported-by: Emond Papegaaij <emond.papegaaij@gmail.com>
Reported-by: Claude code
Author: Taiki Koshino <koshino@sraoss.co.jp>
Discussion: https://www.postgresql.org/message-id/TY4PR01MB1737480CA247F6CCBD87C958694C22%40TY4PR01MB17374.jpnpr...
Backpatch-through: v4.3

Branch
------
V4_4_STABLE

Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=3d234eb8e486f566099711229f07f3c4394b3...

Modified Files
--------------
src/protocol/child.c | 46 +++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 41 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgpool: Convert close_idle_connection (SIGUSR1) to flag-only handler wi
@ 2026-09-16 08:48 Taiki Koshino <koshino@sraoss.co.jp>
  0 siblings, 0 replies; 6+ messages in thread

From: Taiki Koshino @ 2026-09-16 08:48 UTC (permalink / raw)
  To: pgpool-committers@lists.postgresql.org

Convert close_idle_connection (SIGUSR1) to flag-only handler with main-loop processing.

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.

Reported-by: Emond Papegaaij <emond.papegaaij@gmail.com>
Reported-by: Claude code
Author: Taiki Koshino <koshino@sraoss.co.jp>
Discussion: https://www.postgresql.org/message-id/TY4PR01MB1737480CA247F6CCBD87C958694C22%40TY4PR01MB17374.jpnpr...
Backpatch-through: v4.3

Branch
------
V4_3_STABLE

Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=8c9bd3293d5f25d97d5b3f8520f0469d6df1c...

Modified Files
--------------
src/protocol/child.c | 46 +++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 41 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2026-09-16 08:48 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-09-16 08:46 pgpool: Convert close_idle_connection (SIGUSR1) to flag-only handler wi Taiki Koshino <koshino@sraoss.co.jp>
2026-09-16 08:46 pgpool: Convert close_idle_connection (SIGUSR1) to flag-only handler wi Taiki Koshino <koshino@sraoss.co.jp>
2026-09-16 08:46 pgpool: Convert close_idle_connection (SIGUSR1) to flag-only handler wi Taiki Koshino <koshino@sraoss.co.jp>
2026-09-16 08:47 pgpool: Convert close_idle_connection (SIGUSR1) to flag-only handler wi Taiki Koshino <koshino@sraoss.co.jp>
2026-09-16 08:47 pgpool: Convert close_idle_connection (SIGUSR1) to flag-only handler wi Taiki Koshino <koshino@sraoss.co.jp>
2026-09-16 08:48 pgpool: Convert close_idle_connection (SIGUSR1) to flag-only handler wi Taiki Koshino <koshino@sraoss.co.jp>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox