MXS-1921: Explain why session was closed
When a client connection is closed by MaxScale before the client initiates a controlled closing of the connection, an error message is sent. This error message now also explains why the connection was closed to make problem resolution easier.
This commit is contained in:
@ -1136,12 +1136,14 @@ gw_read_finish_processing(DCB *dcb, GWBUF *read_buffer, uint64_t capabilities)
|
||||
if (return_code != 0)
|
||||
{
|
||||
/** Routing failed, close the client connection */
|
||||
dcb->session->close_reason = SESSION_CLOSE_ROUTING_FAILED;
|
||||
dcb_close(dcb);
|
||||
MXS_ERROR("Routing the query failed. Session will be closed.");
|
||||
}
|
||||
else if (proto->current_command == MXS_COM_QUIT)
|
||||
{
|
||||
/** Close router session which causes closing of backends */
|
||||
ss_info_dassert(session_valid_for_pool(dcb->session), "Session should qualify for pooling");
|
||||
dcb_close(dcb);
|
||||
}
|
||||
|
||||
@ -1471,7 +1473,15 @@ static int gw_client_hangup_event(DCB *dcb)
|
||||
}
|
||||
|
||||
// The client did not send a COM_QUIT packet
|
||||
modutil_send_mysql_err_packet(dcb, 0, 0, 1927, "08S01", "Connection killed by MaxScale");
|
||||
std::string errmsg{"Connection killed by MaxScale"};
|
||||
std::string extra{session_get_close_reason(dcb->session)};
|
||||
|
||||
if (!extra.empty())
|
||||
{
|
||||
errmsg += ": " + extra;
|
||||
}
|
||||
|
||||
modutil_send_mysql_err_packet(dcb, 0, 0, 1927, "08S01", errmsg.c_str());
|
||||
}
|
||||
dcb_close(dcb);
|
||||
}
|
||||
|
Reference in New Issue
Block a user