diff --git a/server/modules/protocol/mysql_backend.c b/server/modules/protocol/mysql_backend.c index 0cb80a059..fc11484c7 100644 --- a/server/modules/protocol/mysql_backend.c +++ b/server/modules/protocol/mysql_backend.c @@ -299,13 +299,17 @@ static int gw_read_backend_event(DCB *dcb) { dcb->delayq, gwbuf_length(dcb->delayq)); } - rsession = session->router_session; - ss_dassert(rsession != NULL); - /*< + ss_dassert(session->state == SESSION_READY); + /** * vraa : errorHandle - * rsession should never be NULL here. - **/ - ss_dassert(rsession != NULL); + * rsession may be NULL if session is being created + * in parallel by another thread. + */ + while(session->router_session == NULL) + { + usleep(1); + } + rsession = session->router_session; LOGIF(LD, (skygw_log_write_flush( LOGFILE_DEBUG, @@ -792,12 +796,18 @@ static int backend_write_delayqueue(DCB *dcb) if (rc == 0) { /*< vraa : errorHandle */ + /** + * This error can be muted because it is often due + * unexpected dcb state which means that concurrent thread + * already wrote the queue and closed dcb. + */ +#if 0 LOGIF(LE, (skygw_log_write_flush( LOGFILE_ERROR, "%lu [backend_write_delayqueue] Some error occurred in " "backend.", pthread_self()))); - +#endif mysql_send_custom_error( dcb->session->client, 1, diff --git a/server/modules/protocol/mysql_common.c b/server/modules/protocol/mysql_common.c index a48ec8ed8..1ee25db27 100644 --- a/server/modules/protocol/mysql_common.c +++ b/server/modules/protocol/mysql_common.c @@ -362,7 +362,7 @@ int gw_receive_backend_auth( { ss_dassert(n < 0 && head == NULL); rc = -1; - LOGIF(LD, (skygw_log_write( + LOGIF(LD, (skygw_log_write_flush( LOGFILE_DEBUG, "%lu [gw_receive_backend_auth] Reading from backend dcb %p " "fd %d in state %s failed. n %d, head %p, len %d",