diff --git a/server/core/backend.cc b/server/core/backend.cc index 3dd915ca6..6ffa3777d 100644 --- a/server/core/backend.cc +++ b/server/core/backend.cc @@ -43,6 +43,8 @@ Backend::~Backend() void Backend::close(close_type type) { + ss_dassert(m_dcb->n_close == 0); + if (!m_closed) { m_closed = true; diff --git a/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.c b/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.c index 02a428348..6769d503f 100644 --- a/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.c +++ b/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.c @@ -599,13 +599,8 @@ static void gw_reply_on_error(DCB *dcb, mxs_auth_state_t state) MXS_SESSION *session = dcb->session; CHK_SESSION(session); - if (!dcb->dcb_errhandle_called) - { - do_handle_error(dcb, ERRACT_REPLY_CLIENT, - "Authentication with backend failed. Session will be closed."); - session->state = SESSION_STATE_STOPPING; - dcb->dcb_errhandle_called = true; - } + do_handle_error(dcb, ERRACT_REPLY_CLIENT, + "Authentication with backend failed. Session will be closed."); } /** @@ -1348,7 +1343,7 @@ static int gw_backend_close(DCB *dcb) session->state == SESSION_STATE_STOPPING && session->client_dcb->state == DCB_STATE_POLLING) { - dcb_close(session->client_dcb); + poll_fake_hangup_event(session->client_dcb); } return 1;