[pgpool-committers: 4008] pgpool: Fix pgpool child process segfault reported in [pgpool-hackers:

Tatsuo Ishii ishii at postgresql.org
Thu May 4 16:50:22 JST 2017


Fix pgpool child process segfault reported in [pgpool-hackers: 2312].

When MASTER macro calls, pool_virtual_master_db_node_id() which calls
pool_get_preferred_master_node_id() if there's no query context
exists. The segfault happens in deciding the load balance node while
initializing the session context in the child process starting up. The
session context is first initialized with all 0, then
pool_get_preferred_master_node_id() returns 0 as the preferred node
id. This is fine as long as node 0 is healthy. However if node 0 goes
down and failover happens, this is not fine any more since the
connection slot 0 is empty and it causes the segfault. Fix it by
initializing session_contex->preferred_master_node_id before deciding
the load balancing node.

This bug was introduced in 18f95017586aacb7254bbccda18ba67c01468483 by
me.  Back patched to 3.6 and 3.5 stable branches with less invasive
patch.  However probably we could eliminate the preferred node staffs,
so more invasive patch will be applied to master branch only.

Branch
------
V3_6_STABLE

Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=2b0edb11510ce6f52f1aa7b78d82ab2daccadd26

Modified Files
--------------
src/context/pool_session_context.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)



More information about the pgpool-committers mailing list