diff options
author | Tatsuo Ishii | 2024-11-08 10:53:50 +0000 |
---|---|---|
committer | Tatsuo Ishii | 2024-11-08 11:18:46 +0000 |
commit | 25ad9e6d50343e2cbd4dc337803d231c92141021 (patch) | |
tree | c2394a4c87bbe4b7ff64a00a0b1448182423850e /src | |
parent | 627ace7bb60ef21347dad8ff4e89041578b9c31c (diff) |
Fix Pgpool-II child process crash during shutdown.
It is reported that pgpool child process crashes during shutdown.
[pgpool-general: 9261] Re: Segmentation fault during shutdown
The actual crash was in close_all_backend_connections().
close_all_backend_connections() was called because on_system_exit
registers child_will_ho_down(). At the moment it seems pgpool child
had just started up and doing pool_init_cp(). The connection pool
object had not been completely initialized, that's cause of the crash.
To fix this, just remove the call to close_all_backend_connections()
in child_will_ho_down(). Although this will prevent the terminate
message ('X') being sent to backend, it should be harmless since
backend can take care such a disconnection without a terminate
message.
Problem reported and analyzed by: Emond Papegaaij
Backpatch-through: v4.2
Discussion: https://www.pgpool.net/pipermail/pgpool-general/2024-November/001938.html
Diffstat (limited to 'src')
-rw-r--r-- | src/protocol/child.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/protocol/child.c b/src/protocol/child.c index c12a5a2c1..4e2a3443b 100644 --- a/src/protocol/child.c +++ b/src/protocol/child.c @@ -1350,9 +1350,12 @@ child_will_go_down(int code, Datum arg) memcached_disconnect(); } - /* let backend know now we are exiting */ - if (pool_connection_pool) - close_all_backend_connections(); + /* + * We used to call close_all_backend_connections() here so that we send + * 'X' (terminate) message to backend. However it was possible that the + * function is called while initializing the connection pool object, which + * leads to crash. So we stopped to call close_all_backend_connections(). + */ } /* |