pgpool2.git / summary / log / commit / refs
commit e3fc50a13818d41b61b721092bc41556e8a62bab
Author: Tatsuo Ishii <ishii@postgresql.org>
Date: Fri Jan 27 07:12:47 2017 +0000
Fix do_query() hangs after close message.
This is an en-bug in 3.6.1.
If an extend query appears right after a close message, do_query() is
called to check system catalogs, it hangs because it expects to read
pending data. This is caused by being mistakenly set the pending flag
after Close().
Back patch to 3.6-stable and 3.5-stable.
src/context/pool_session_context.c | 6 ++++++
src/protocol/pool_proto_modules.c | 5 ++++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/context/pool_session_context.c b/src/context/pool_session_context.c
index 10608679d..773ff7879 100644
--- a/src/context/pool_session_context.c
+++ b/src/context/pool_session_context.c
@@ -1000,6 +1000,9 @@ void pool_set_pending_response(void)
ereport(ERROR,
(errmsg("pool_set_pending_response: session context is not initialized")));
+ ereport(DEBUG1,
+ (errmsg("pool_set_pending_response")));
+
session_context->is_pending_response = true;
}
@@ -1012,6 +1015,9 @@ void pool_unset_pending_response(void)
ereport(ERROR,
(errmsg("pool_unset_pending_response: session context is not initialized")));
+ ereport(DEBUG1,
+ (errmsg("pool_unset_pending_response")));
+
session_context->is_pending_response = false;
}
diff --git a/src/protocol/pool_proto_modules.c b/src/protocol/pool_proto_modules.c
index 9d05d82e7..638225073 100644
--- a/src/protocol/pool_proto_modules.c
+++ b/src/protocol/pool_proto_modules.c
@@ -1517,6 +1517,10 @@ POOL_STATUS Close(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend,
pmsg = pool_pending_messages_create('C', len, contents);
pool_pending_message_add(pmsg);
pool_unset_query_in_progress();
+ /*
+ * Remeber that we send flush or sync message to backend.
+ */
+ pool_unset_pending_response();
}
return POOL_CONTINUE;
@@ -2420,7 +2424,6 @@ POOL_STATUS ProcessFrontendResponse(POOL_CONNECTION *frontend,
if (!pool_is_query_in_progress() && !pool_is_ignore_till_sync())
pool_set_query_in_progress();
status = Close(frontend, backend, len, contents);
- pool_set_pending_response();
break;
case 'D': /* Describe */
[parent: b0232aba484e]