When the COM_CHANGE_USER command is sent to the backend server, the response returned by the server sometimes contains two replies.
This behavior is caused by the closing of a persistent connection while it is waiting for the COM_CHANGE_USER response. When the connection that was waiting for the reply is taken back into use before the reply arrives, another COM_CHANGE_USER is sent. This causes two replies to be sent to what appears to be a single COM_CHANGE_USER command.
The fix to this is to extend the qualification checks for the connection pool to also check whether the connection is waiting for the response to the COM_CHANGE_USER.