[pgpool-committers: 4052] pgpool: Fix extended query hang in certain case.

Tatsuo Ishii ishii at postgresql.org
Tue May 23 09:24:56 JST 2017

Fix extended query hang in certain case.

While digging into "[pgpool-general: 5487] pgpool and erlang - request hangs",
I found a certain sequence of messages which cause Pgpool-II hang.

errlang PostgreSQL API produces Parse ('P'), Describe ('D'), Flush
('H'), Bind ('B'), and Execute ('E'). Notice the 'H' message (this
does not happen in JDBC. I suspect that's the reason why this problem
is not popular before). After that, Pgpool-II dropped the extended
query mode, it failed to find which backend to read data. Thus
Pgpool-II simply tries to read all of backend which causes hang
because it may have not send a message to some of backends.

Solution is, after receiving the flush message set doing extended
query flag.

For the record, here is the pgproto data to reproduce the problem.

'Q'	"DROP TABLE IF EXISTS pgproto_test1"
'Q'	"CREATE TABLE pgproto_test1(i INT)"
'Q'	"INSERT INTO pgproto_test1 VALUES(1)"

'P'	"S2"	"SELECT 1 FROM pgproto_test1"	0
'D'	'S'	"S2"
'B'	""	"S2"	0	0	0
'E'	""	0
'C'	'S'	"S2"


Note that the cause of original complain seems to different from this
because it is operated in replication mode. So it needs more

Back patched to 3.6 and 3.5 stable branches.



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

More information about the pgpool-committers mailing list