MXS-1033: Fix crash on 'maxadmin list clients'

When the client connections were listed, the DCB state was not
inspected. Only DCBs in the polling state should be printed as they are
guaranteed to be in a valid state.
This commit is contained in:
Markus Makela 2016-11-30 23:10:24 +02:00
parent 82ef1a9149
commit ac0f975f9c

View File

@ -2157,7 +2157,7 @@ dListDCBs(DCB *pdcb)
dcb_printf(pdcb, "------------------+----------------------------+--------------------+----------\n");
while (dcb)
{
if (dcb->dcb_is_in_use)
if (dcb->dcb_is_in_use && dcb->state == DCB_STATE_POLLING)
{
dcb_printf(pdcb, " %-16p | %-26s | %-18s | %s\n",
dcb, gw_dcb_state2string(dcb->state),
@ -2189,7 +2189,8 @@ dListClients(DCB *pdcb)
dcb_printf(pdcb, "-----------------+------------------+----------------------+------------\n");
while (dcb)
{
if (dcb->dcb_is_in_use && dcb->dcb_role == DCB_ROLE_CLIENT_HANDLER)
if (dcb->dcb_is_in_use && dcb->dcb_role == DCB_ROLE_CLIENT_HANDLER &&
dcb->state == DCB_STATE_POLLING)
{
dcb_printf(pdcb, " %-15s | %16p | %-20s | %10p\n",
(dcb->remote ? dcb->remote : ""),