[pgpool-committers: 5397] pgpool: Fix occasional extended query hang.

Tatsuo Ishii ishii at sraoss.co.jp
Wed Dec 12 15:29:25 JST 2018

Fix occasional extended query hang.

If a client sends a extended query message such as close after sync
message but before next simple query, Pgpool-II could hang.

<= BE ParseComplete
<= BE BindComplete
<= BE CommandComplete(COMMIT)
<= BE ReadyForQuery(I)
FE=> Close(stmt="S2")
FE=> Close(stmt="S1")
FE=> Query (query="BEGIN") [0]
<= BE CloseComplete [1]
<= BE CloseComplete [1]
<= BE CommandComplete(BEGIN) [2]

Because of [1], query in progress flag was reset, then [2] hangs
trying to read from backend which did not receive message from
Pgpool-II because it does not refer to the query context set by [0].

Sending close after sync is not recommended according to the official
document but some sloppy drivers seem to do it. To deal with the
problem, check the doing extended query message flag before resetting
the query in progress flag.

Problem reported by Muhammad Usama.
Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2018-December/003164.html



Modified Files
src/protocol/pool_proto_modules.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

More information about the pgpool-committers mailing list