Moved error messages about broken pipe to DEBUG build since in cases we've seen it is due to socket closing in same host. Other case is that MaxScale attempts to write COM_QUIT (ending message) to socket that other thread already closed.
Added counter clean-up code to readwritesplit closeSession. If operation counters have leaked, that is, due to some error in query routing some counter have been left positive, it is zeroed at session ending. This ensures that there is no garbage in global counter even if individual session wouldn't clean up its counters.
This commit is contained in:
parent
0dfdc27ea5
commit
a68d83ff7f
@ -1042,8 +1042,14 @@ int above_water;
|
||||
|
||||
if (w < 0)
|
||||
{
|
||||
#if defined(SS_DEBUG)
|
||||
if (saved_errno == EAGAIN ||
|
||||
saved_errno == EWOULDBLOCK)
|
||||
#else
|
||||
if (saved_errno == EAGAIN ||
|
||||
saved_errno == EWOULDBLOCK ||
|
||||
saved_errno == EPIPE)
|
||||
#endif
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -820,21 +820,27 @@ static void closeSession(
|
||||
|
||||
for (i=0; i<router_cli_ses->rses_nbackends; i++)
|
||||
{
|
||||
DCB* dcb = backend_ref[i].bref_dcb;
|
||||
backend_ref_t* bref = &backend_ref[i];
|
||||
DCB* dcb = bref->bref_dcb;
|
||||
|
||||
/** Close those which had been connected */
|
||||
if (BREF_IS_IN_USE((&backend_ref[i])))
|
||||
if (BREF_IS_IN_USE(bref))
|
||||
{
|
||||
CHK_DCB(dcb);
|
||||
bref_clear_state(&backend_ref[i], BREF_IN_USE);
|
||||
bref_set_state(&backend_ref[i], BREF_CLOSED);
|
||||
/** Clean operation counter in bref and in SERVER */
|
||||
while (BREF_IS_WAITING_RESULT(bref))
|
||||
{
|
||||
bref_clear_state(bref, BREF_WAITING_RESULT);
|
||||
}
|
||||
bref_clear_state(bref, BREF_IN_USE);
|
||||
bref_set_state(bref, BREF_CLOSED);
|
||||
/**
|
||||
* closes protocol and dcb
|
||||
*/
|
||||
dcb_close(dcb);
|
||||
/** decrease server current connection counters */
|
||||
atomic_add(&backend_ref[i].bref_backend->backend_server->stats.n_current, -1);
|
||||
atomic_add(&backend_ref[i].bref_backend->backend_conn_count, -1);
|
||||
atomic_add(&bref->bref_backend->backend_server->stats.n_current, -1);
|
||||
atomic_add(&bref->bref_backend->backend_conn_count, -1);
|
||||
}
|
||||
}
|
||||
/** Unlock */
|
||||
|
Loading…
x
Reference in New Issue
Block a user