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:56 +0000 (11:33 +0900)
commit2280851706fa9ceb5f836bc12b798d909a515c28
tree4721c65b2b66f26d61157596ab8984b35011eeba
parent1a089995ca58f4e2d225507c5a6061f57f7bdc61
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