diff --git a/src/protocol/pool_proto_modules.c b/src/protocol/pool_proto_modules.c
index 9f3552515..2d1535e58 100644
--- a/src/protocol/pool_proto_modules.c
+++ b/src/protocol/pool_proto_modules.c
@@ -118,6 +118,8 @@ static void add_sync_pending_message(void);
 
 static void handle_copy_in(POOL_QUERY_CONTEXT *query_context);
 
+static bool check_frontend_message_kind(char fkind);
+
 /*
  * This is the workhorse of processing the pg_terminate_backend function to
  * make sure that the use of function should not trigger the backend node failover.
@@ -2900,9 +2902,20 @@ ProcessFrontendResponse(POOL_CONNECTION *frontend,
 			(errmsg("processing frontend response"),
 			 errdetail("received kind '%c'(%02x) from frontend", fkind, fkind)));
 
-
 	if (MAJOR(backend) == PROTO_MAJOR_V3)
 	{
+		/* Check V3 message kind */
+		if (!check_frontend_message_kind(fkind))
+		{
+			/*
+			 * We lost message boundary sync. There's no way to recover.
+			 */
+			ereport(FATAL,
+					(return_code(2),	/* this lets parent pgppol to restart a new child. */
+					 errcode(ERRCODE_PROTOCOL_VIOLATION),
+					 errmsg("invalid frontend message type '%c'", fkind)));
+		}
+
 		if (pool_read(frontend, &len, sizeof(len)) < 0)
 			ereport(ERROR,
 					(errmsg("unable to process frontend response"),
@@ -5471,3 +5484,34 @@ handle_copy_in(POOL_QUERY_CONTEXT *query_context)
 	 */
 	pool_set_suspend_reading_from_frontend_copy_in();
 }
+
+/*
+ * Check v3 frontend message kind
+ * Returns false if invalid message kind is given
+ */
+static bool
+check_frontend_message_kind(char fkind)
+{
+	switch (fkind)
+	{
+		case 'B':				/* Bind */
+		case 'C':				/* Close */
+		case 'D':				/* Describe */
+		case 'E':				/* Execute */
+		case 'F':				/* FunctionCall */
+		case 'H':				/* Flush */
+		case 'P':				/* Parse */
+		case 'Q':				/* Query */
+		case 'S':				/* Sync */
+		case 'X':				/* Terminate */
+		case 'c':				/* CopyDone */
+		case 'd':				/* CopyData */
+		case 'f':				/* CopyFail */
+			return true;
+			break;
+
+		default:
+			break;
+	}
+	return false;
+}
