pgpool2.git / summary / log / commit / refs

commit    60b242419c802ec8a289fc74640b5120d9506fe0
Author:   Tatsuo Ishii <ishii@postgresql.org>
Date:     Fri Oct 16 09:18:09 2015 +0000

    Fix bug reported in bug#145.
    
    The problem occurs when all the condition below are met:
    
    1) pgpool-II 3.4 or later
    2) streaming replication mode
    3) primary node is also load balance node
    4) extended protocol is used
    5) client_idle_limit reached
    
    After the extended protocol query finished, the client stays idle. When
    client_idle_limit is reached, reset_query_list() is called to send
    reset query but it is only sent to the primary node. CommandComplete
    message is returned from the primary node. Because
    doing_extended_query_message flag remains on, ProcessBackendResponse()
    happily resets query_in_progress flag. The ReadyForQuery message
    arrives and pgpool-II tries to read the message not only from the
    primary but the standby because there's no query context (remember that
    the query_in_progress flags is off). Since the standby did not receive
    the reset query, it does not respond and pgpool-II hangs here.
    
    The fix is, resetting doing_extended_query_message flag in
    reset_query_list().
    
    Note that pgpool-II 3.3 or before does not have the problem since it
    disconnects connections to backend right after client_idle_limit is
    reached.


src/protocol/pool_process_query.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/protocol/pool_process_query.c b/src/protocol/pool_process_query.c index cddca805d..9f6c7f6c7 100644 --- a/src/protocol/pool_process_query.c +++ b/src/protocol/pool_process_query.c @@ -966,6 +966,11 @@ static int /* Set reset context */ session_context->reset_context = true; + /* + * Make sure that we are not doing extended protocol. + */ + pool_unset_doing_extended_query_message(); + /* * Reset all state variables */ [parent: 180bb29fc5bc]