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:
@ -583,6 +583,7 @@ static void do_handle_error(DCB *dcb, mxs_error_action_t action, const char *err
|
||||
*/
|
||||
if (!succp)
|
||||
{
|
||||
session->close_reason = SESSION_CLOSE_HANDLEERROR_FAILED;
|
||||
poll_fake_hangup_event(session->client_dcb);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -1704,6 +1704,7 @@ static bool kill_func(DCB *dcb, void *data)
|
||||
else
|
||||
{
|
||||
// DCB is not yet connected, send a hangup to forcibly close it
|
||||
dcb->session->close_reason = SESSION_CLOSE_KILLED;
|
||||
poll_fake_hangup_event(dcb);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user