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

Tatsuo Ishii ishii at postgresql.org
Thu May 4 17:06:33 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 removing preferred_master_node_id staffs since it seems it
is not used anymore.



Modified Files
src/context/pool_query_context.c           |     6 -
src/context/pool_session_context.c         |     4 +
src/include/context/pool_session_context.h |     5 +-
src/parser/gram.c                          | 18396 +++++++++++++--------------
src/parser/gram.h                          |   941 +-
src/protocol/pool_proto_modules.c          |     3 +-
6 files changed, 9011 insertions(+), 10344 deletions(-)

More information about the pgpool-committers mailing list