poll.c:Returned checks for zombie

mysql_backend.c:don't write to session->client if session->client is NULL
mysql_common.c:assert if called with dcb==NULL
This commit is contained in:
vraatikka 2013-09-12 22:34:49 +03:00
parent bbc9dcc9a3
commit d7e793a411
3 changed files with 31 additions and 3 deletions

View File

@ -263,11 +263,17 @@ poll_waitevents(void *arg)
{
atomic_add(&pollStats.n_error, 1);
dcb->func.error(dcb);
if (DCB_ISZOMBIE(dcb)) {
continue;
}
}
if (ev & EPOLLHUP)
{
atomic_add(&pollStats.n_hup, 1);
dcb->func.hangup(dcb);
if (DCB_ISZOMBIE(dcb)) {
continue;
}
}
if (ev & EPOLLOUT)
{

View File

@ -360,7 +360,9 @@ static int gw_write_backend_event(DCB *dcb) {
/**
* Don't write to backend if backend_dcb is not in poll set anymore.
*/
if (dcb->state != DCB_STATE_POLLING) {
if (dcb->state != DCB_STATE_POLLING &&
dcb->session->client != NULL)
{
mysql_send_custom_error(
dcb->session->client,
1,

View File

@ -39,13 +39,33 @@ extern int gw_MySQLWrite_backend(DCB *dcb, GWBUF *queue);
extern int gw_error_backend_event(DCB *dcb);
/**
* @node Creates MySQL protocol structure
*
* Parameters:
* @param dcb - in, use
* Must be non-NULL.
*
* @return
*
*
* @details (write detailed description here)
*
*/
MySQLProtocol* mysql_protocol_init(
DCB* dcb)
{
MySQLProtocol* p;
if (dcb != NULL) {
CHK_DCB(dcb);
CHK_DCB(dcb);
if (dcb == NULL) {
skygw_log_write_flush(
LOGFILE_ERROR,
"%lu [mysql_init_protocol] MySQL protocol init failed : "
"called with DCB == NULL.",
pthread_self());
return NULL;
}
p = (MySQLProtocol *) calloc(1, sizeof(MySQLProtocol));
ss_dassert(p != NULL);