From ca7f5ea91f5528b9a2ffdd702358e0a85cc4279b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jaramago=20Fern=C3=A1ndez?= Date: Tue, 22 Mar 2022 17:25:23 +0100 Subject: [PATCH] Create new message code 'PCM-10001' for 'Unexpected packet from client' error --- lib/MySQL_Session.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/MySQL_Session.cpp b/lib/MySQL_Session.cpp index 88c550574..b774a7cad 100644 --- a/lib/MySQL_Session.cpp +++ b/lib/MySQL_Session.cpp @@ -3447,7 +3447,7 @@ void MySQL_Session::handler___status_NONE_or_default(PtrSize_t& pkt) { return; } } - proxy_error("Unexpected packet from client %s . Session_status: %d , client_status: %d Disconnecting it\n", buf, status, client_myds->status); + proxy_error2(10001, "Unexpected packet from client %s . Session_status: %d , client_status: %d Disconnecting it\n", buf, status, client_myds->status); if (thread) { thread->status_variables.stvar[st_var_unexpected_packet]++; } @@ -3476,7 +3476,10 @@ void MySQL_Session::handler___status_WAITING_CLIENT_DATA___default() { sprintf(buf, "localhost"); break; } - proxy_error("Unexpected packet from client %s . Session_status: %d , client_status: %d Disconnecting it\n", buf, status, client_myds->status); + // PMC-10001: A unexpected packet has been received from client. This error has two potential causes: + // * Bug: ProxySQL state machine wasn't in the correct state when a legitimate client packet was received. + // * Client error: The client incorrectly sent a packet breaking MySQL protocol. + proxy_error2(10001, "Unexpected packet from client %s . Session_status: %d , client_status: %d Disconnecting it\n", buf, status, client_myds->status); } }