Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
markus456 committed Dec 1, 2016
1 parent 3db3ab1 commit 1272ccc
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions server/modules/routing/readwritesplit/readwritesplit.c
Expand Up @@ -959,12 +959,19 @@ static void closeSession(ROUTER *instance, void *router_session)
}
bref_clear_state(bref, BREF_IN_USE);
bref_set_state(bref, BREF_CLOSED);
/**
* closes protocol and dcb
*/

RW_CHK_DCB(bref, dcb);
dcb_close(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);
}

RW_CLOSE_BREF(bref);

/** decrease server current connection counters */
atomic_add(&bref->bref_backend->backend_conn_count, -1);
}
Expand Down

0 comments on commit 1272ccc

Please sign in to comment.