diff --git a/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c b/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c index 5999c4052..32c292301 100644 --- a/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c +++ b/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c @@ -1027,12 +1027,11 @@ static int gw_MySQLWrite_backend(DCB *dcb, GWBUF *queue) if (MYSQL_IS_COM_QUIT((uint8_t*)GWBUF_DATA(queue))) { /** The COM_CHANGE_USER was already sent but the session is already - * closing. We ignore the COM_QUIT in the hopes that the response - * to the COM_CHANGE_USER comes before the DCB is closed. If the - * DCB is closed before the response arrives, the connection will - * not qualify the persistent connection pool. */ - MXS_INFO("COM_QUIT received while COM_CHANGE_USER is in progress, ignoring"); + * closing. */ + MXS_INFO("COM_QUIT received while COM_CHANGE_USER is in progress, closing pooled connection"); gwbuf_free(queue); + poll_fake_hangup_event(dcb); + rc = 0; } else { @@ -1044,8 +1043,9 @@ static int gw_MySQLWrite_backend(DCB *dcb, GWBUF *queue) */ MXS_INFO("COM_CHANGE_USER in progress, appending query to queue"); backend_protocol->stored_query = gwbuf_append(backend_protocol->stored_query, queue); + rc = 1; } - return 1; + return rc; } /**