[pgpool-committers: 8332] pgpool: Fix pcp_node_info hang when pgpool cannot connect to backend.

Tatsuo Ishii ishii at sraoss.co.jp
Thu Jan 27 09:18:47 JST 2022

Fix pcp_node_info hang when pgpool cannot connect to backend.

Since 4.3 pcp_node_info (and show pool_nodes) try to connect to all
backend to obtain real-time and actual backend status.  In certain
cases connect(2) fails and keeps on retrying, and the command does not
complete. To fix this, following modifications are made:

1) db_node_status(), which is responsible for probing backend is alive
or not, tries to connect backend with "connect_timeout" parameter
enabled. The timeout is taken from "connect_timeout" parameter of
pgpool.conf. If connect_timeout in pgpool.conf disabled (i.e. set to
0), the timeout parameter is not set. In this case the command will
not complete.

2) db_node_role(), which is responsible for fetching backend role (primary
or standby), does to not retry in connecting to backend using

3) inform_node_info(), which is the workhorse of pcp_node_info, tries
to fetch info (thus calling db_node_status() and db_node_role()) only
for specified backend. Before it unconditionally access all backend.

Problem reported and patch reviewed by Emond Papegaaij.

Discussion: https://www.pgpool.net/pipermail/pgpool-general/2022-January/008042.html



Modified Files
src/include/utils/pool_process_reporting.h |  4 ++--
src/pcp_con/pcp_worker.c                   |  6 ++---
src/utils/pool_process_reporting.c         | 37 +++++++++++++++++++++++-------
3 files changed, 34 insertions(+), 13 deletions(-)

More information about the pgpool-committers mailing list