From 630165e52b2f6d5ef54d8ab0c7830b978e003332 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Fri, 28 Dec 2018 12:41:18 +0200 Subject: [PATCH] Fix closing of pooled DCBs DCBs can now have a null session pointer and if they do, they are in the persistent pool. The no-null-session assertions are no longer valid but with a reorganization of the pooling code to only use file descriptors, the assertions can be added back. --- .../protocol/MySQL/mariadbbackend/mysql_backend.cc | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.cc b/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.cc index 389da5c16..1a39822f0 100644 --- a/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.cc +++ b/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.cc @@ -1367,7 +1367,7 @@ static int gw_backend_hangup(DCB* dcb) */ static int gw_backend_close(DCB* dcb) { - mxb_assert(dcb->session); + mxb_assert(dcb->session || dcb->persistentstart); /** Send COM_QUIT to the backend being closed */ GWBUF* quitbuf = mysql_create_com_quit(NULL, 0); @@ -1376,17 +1376,13 @@ static int gw_backend_close(DCB* dcb) /** Free protocol data */ mysql_protocol_done(dcb); - MXS_SESSION* session = dcb->session; - /** * If session state is SESSION_STATE_STOPPING, start closing client session. * Otherwise only this backend connection is closed. */ - if (session->client_dcb - && session->state == SESSION_STATE_STOPPING - && session->client_dcb->state == DCB_STATE_POLLING) + if (dcb->session && dcb->session->state == SESSION_STATE_STOPPING) { - poll_fake_hangup_event(session->client_dcb); + poll_fake_hangup_event(dcb->session->client_dcb); } return 1;