diff --git a/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.c b/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.c index e67672a69..5a060e0e1 100644 --- a/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.c +++ b/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.c @@ -766,9 +766,13 @@ gw_read_and_write(DCB *dcb) return 0; } - if (rcap_type_required(capabilities, RCAP_TYPE_SESSION_STATE_TRACKING)) + /** Get sesion track info from ok packet and save it to gwbuf properties. + * + * The OK packets sent in response to COM_STMT_PREPARE are of a different + * format so we need to detect and skip them. */ + if (rcap_type_required(capabilities, RCAP_TYPE_SESSION_STATE_TRACKING) && + !expecting_ps_response(proto)) { - /** Get session track info from ok packet and save it to gwbuf properties */ mxs_mysql_get_session_track_info(tmp, proto); }