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 13:14:38 +0000 (22:14 +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.

src/protocol/pool_proto_modules.c

index 362c1087df2d911135f74b5334083ec6d1c120d6..631fa5d3c63b1b5063435b36d2f03d2c06e9ed9f 100644 (file)
@@ -3270,6 +3270,8 @@ static POOL_STATUS parse_before_bind(POOL_CONNECTION *frontend,
 
        if (!SL_MODE && parse_was_sent)
        {
+               pool_set_query_in_progress();
+
                while (kind != '1')
                {
                        PG_TRY();