Fix pgpool crash when pgpool child process exits.
authorTatsuo Ishii <ishii@postgresql.org>
Wed, 18 Sep 2024 02:25:10 +0000 (11:25 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Wed, 18 Sep 2024 02:33:38 +0000 (11:33 +0900)
commit4ac2f8801508922ef75c5f476b8edae988f635c1
treed7e4d18dae254e6db49f7525eb7cbdd141211169
parentb9b2b6edfb7a1b215c2a52b3db90695b6258145f
Fix pgpool crash when pgpool child process exits.

When a pgpool child process exits, close_all_backend_connections() is
called, which is responsible for closing all connections to backend in
the connection pool. It used mistakenly MAIN_CONNECTION macro, which
is fine for current active connections but is not good for pooled
connections because a main node could be different at the time when
the connection pool was created. Fix is using in_use_backend()
instead.

Reported-by: Emond Papegaaij
Backpatch-through: v4.2
src/protocol/pool_connection_pool.c