From c8d7214741b6fbe385e925cb2e1c6036d737d384 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20de=20Giessen?= Date: Thu, 8 Jul 2021 23:54:08 +0200 Subject: [PATCH] Fix hang when describing nodata statement 743a69b addressed an hang caused by SimpleForwardToFrontend buffering the response to a Describe (statement) message by flushing the buffer for RowDescription messages. However, a NoData message is also a valid response to certain Describe messages, for example for a "LISTEN" statement. To fix this we also now flush for a NoData message. --- src/protocol/pool_process_query.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/protocol/pool_process_query.c b/src/protocol/pool_process_query.c index 68db8819..9a2ca8b3 100644 --- a/src/protocol/pool_process_query.c +++ b/src/protocol/pool_process_query.c @@ -768,8 +768,8 @@ SimpleForwardToFrontend(char kind, POOL_CONNECTION * frontend, /* * Optimization for other than "Command Complete", "Ready For query", - * "Error response" ,"Notice message", "Notification response" and - * "Row description" + * "Error response" ,"Notice message", "Notification response", + * "Row description" and "No data" * messages. Especially, since it is too often to receive and forward * "Data Row" message, we do not flush the message to frontend now. We * expect that "Command Complete" message (or "Error response" or "Notice @@ -780,7 +780,7 @@ SimpleForwardToFrontend(char kind, POOL_CONNECTION * frontend, * CopyData messages are sent to frontend (typical use case is pg_dump). * So eliminating per CopyData flush significantly enhances performance. */ - if (kind == 'C' || kind == 'Z' || kind == 'E' || kind == 'N' || kind == 'A' || kind == 'T') + if (kind == 'C' || kind == 'Z' || kind == 'E' || kind == 'N' || kind == 'A' || kind == 'T' || kind == 'n') { pool_write_and_flush(frontend, p1, len1); } -- 2.25.1