Make sure DCBs are OK before closing them
Added a check for the validity of the backend DCBs before they are closed. This should guarantee that only valid DCBs are closed by readwritesplit. However, this is not the correct solution for the problem. The DCB should not be in an invalid state in the first place and this fix just removes the bad side effects of the double closing. With the added logging in the readwritesplit error handler, more detailed information should become available.
This commit is contained in:
@ -959,12 +959,19 @@ static void closeSession(ROUTER *instance, void *router_session)
|
|||||||
}
|
}
|
||||||
bref_clear_state(bref, BREF_IN_USE);
|
bref_clear_state(bref, BREF_IN_USE);
|
||||||
bref_set_state(bref, BREF_CLOSED);
|
bref_set_state(bref, BREF_CLOSED);
|
||||||
/**
|
|
||||||
* closes protocol and dcb
|
|
||||||
*/
|
|
||||||
RW_CHK_DCB(bref, dcb);
|
RW_CHK_DCB(bref, dcb);
|
||||||
|
|
||||||
|
/** MXS-956: This will prevent closed DCBs from being closed twice.
|
||||||
|
* It should not happen but for currently unknown reasons, a DCB
|
||||||
|
* gets closed twice; first in handleError and a second time here. */
|
||||||
|
if (dcb && dcb->state == DCB_STATE_POLLING)
|
||||||
|
{
|
||||||
dcb_close(dcb);
|
dcb_close(dcb);
|
||||||
|
}
|
||||||
|
|
||||||
RW_CLOSE_BREF(bref);
|
RW_CLOSE_BREF(bref);
|
||||||
|
|
||||||
/** decrease server current connection counters */
|
/** decrease server current connection counters */
|
||||||
atomic_add(&bref->bref_backend->backend_conn_count, -1);
|
atomic_add(&bref->bref_backend->backend_conn_count, -1);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user