Fix queries hanging in parse_before_bind with extended protocol and replication ...
authorTatsuo Ishii <ishii@postgresql.org>
Thu, 18 Jan 2018 13:14:38 +0000 (22:14 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Thu, 18 Jan 2018 14:27:51 +0000 (23:27 +0900)
In case the client sends a BIND message for a query
that has not yet been parsed by the executing node,
the PARSE will be executed before attempting to BIND
the parameters.

However, during the execution of the PARSE, the session
context is not set to in_progress, which leads to wrong
backend validity tests in read_kind_from_backend which
in turn makes the process wait on a backend which is not
going to send anything.

Fixes bug #377.

Problem analysis and fix by Ancoron Luciferis and me.

pool_proto_modules.c

index 64530c5436092895d9f0501b46442bc0d6142670..7b158fee531a051ac31b510f54da244c0abcc327 100644 (file)
@@ -3513,6 +3513,8 @@ static POOL_STATUS parse_before_bind(POOL_CONNECTION *frontend,
        
        if (parse_was_sent)
        {
+               pool_set_query_in_progress();
+
                while (kind != '1')
                {
                        status = read_kind_from_backend(frontend, backend, &kind);