[pgpool-committers: 9965] pgpool: Fix segfault to not use MAIN_NODE macro.
Tatsuo Ishii
ishii at sraoss.co.jp
Fri Jun 21 16:21:35 JST 2024
Fix segfault to not use MAIN_NODE macro.
Some functions (close_idle_connection(), new_connection() and
pool_create_cp()) used MAIN* and VALID_BACKEND where they are not
appropriate. MAIN* and VALID_BACKEND are only useful against current
connections to backend, not for pooled connections since in pooled
connections which backend is the main node or up and running is
necessarily same as the current connections to backend.
The misuses of those macros sometimes leads to segfault.
This patch introduces new in_use_backend_id() which returns the fist
node id in use. This commit replaces some of MAIN* with the return
value from in_use_backend_id(). Also inappropriate calls to
VALID_BACKEND are replaced with CONNECTION_SLOT macro.
Problem reported by Emond Papegaaij
Discussion: https://www.pgpool.net/pipermail/pgpool-general/2024-June/009176.html
[pgpool-general: 9114] Re: Another segmentation fault
Backpatch-through: V4.1
Branch
------
master
Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=98fff9832f602ea5571427982f1050348f9f0219
Modified Files
--------------
src/include/protocol/pool_connection_pool.h | 4 ++-
src/protocol/child.c | 34 ++++++++------------
src/protocol/pool_connection_pool.c | 50 ++++++++++++++++++++++-------
3 files changed, 54 insertions(+), 34 deletions(-)
More information about the pgpool-committers
mailing list