From d2b8efdd84ec23eb1ba1cee297fd731796228427 Mon Sep 17 00:00:00 2001 From: Tatsuo Ishii Date: Thu, 24 May 2018 13:31:04 +0900 Subject: [PATCH] Fix pgpool main process segfault when PostgreSQL 9.5. is used. pgpool_setup -n 3 (or greater) triggers the bug. While recovering node 2, pgpool main process tried to retrieve version info from backend #2 even if it's not running. This causes the sefault because connection was not established yet. The reason why PostgreSQL 9.6 or later was not suffered from the bug was, PostgreSQL exited the loop as soon as the server version is higher than 9.5. To fix this, call to VALID_BACKEND macro was added. --- src/main/pgpool_main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/pgpool_main.c b/src/main/pgpool_main.c index 74508e1c1..8074b938c 100644 --- a/src/main/pgpool_main.c +++ b/src/main/pgpool_main.c @@ -2962,6 +2962,9 @@ verify_backend_node_status(POOL_CONNECTION_POOL_SLOT **slots) */ for (i=0;i= 90600) { check_connectivity = true; @@ -2982,6 +2985,9 @@ verify_backend_node_status(POOL_CONNECTION_POOL_SLOT **slots) { primary[i] = 0; + if (!VALID_BACKEND(i)) + continue; + if (pool_node_status[i] == POOL_NODE_STATUS_PRIMARY) { ereport(DEBUG1, -- 2.39.5