Fix sending invalid message in SI mode.
authorTatsuo Ishii <ishii@sraoss.co.jp>
Thu, 1 Jul 2021 04:41:34 +0000 (13:41 +0900)
committerTatsuo Ishii <ishii@sraoss.co.jp>
Thu, 1 Jul 2021 04:45:51 +0000 (13:45 +0900)
When a query is aborted by specific reason like serialization error,
Pgpool-II sends error query to abort transactions running on non main
nodes. The message length of the query was incorrect and it caused
"invalid string in message" error on backend.

src/protocol/pool_proto_modules.c

index bd530788a0afd8944b92656bbb2fe0d2ba167d94..89ea8303b7c54d1e93254a783b03efe0c8494217 100644 (file)
@@ -726,7 +726,7 @@ SimpleQuery(POOL_CONNECTION * frontend,
                if (specific_error)
                {
                        char            msg[1024] = POOL_ERROR_QUERY;   /* large enough */
-                       int                     len = strlen(msg);
+                       int                     len = strlen(msg) + 1;
 
                        memset(msg + len, 0, sizeof(int));