Commit 93686c6a authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

Plug leaks caught by c80 with ASAN

This is only a matter of leaving the acceptor loop to always free the
poolsock before returning from the function. This was initially done in
only one place out of three, with no room to exit the accept inner loop
in the absence of an incoming connection.

With this we may have everything in place to drop the drop_pools debug
flag.

Refs 656982a5
Closes #3177
parent 5a55b53a
......@@ -456,13 +456,10 @@ vca_accept_task(struct worker *wrk, void *arg)
do {
i = accept(ls->sock, (void*)&wa.acceptaddr,
&wa.acceptaddrlen);
} while (i < 0 && errno == EAGAIN);
} while (i < 0 && errno == EAGAIN && !ps->pool->die);
if (i < 0 && ps->pool->die) {
VSL(SLT_Debug, 0, "XXX Accept thread dies %p", ps);
FREE_OBJ(ps);
return;
}
if (i < 0 && ps->pool->die)
break;
if (i < 0 && ls->sock == -2) {
/* Shut down in progress */
......@@ -525,15 +522,19 @@ vca_accept_task(struct worker *wrk, void *arg)
* must reschedule the listening task so it will be
* taken up by another thread again.
*/
if (!ps->pool->die)
if (!ps->pool->die) {
AZ(Pool_Task(wrk->pool, &ps->task,
TASK_QUEUE_VCA));
return;
return;
}
}
if (!ps->pool->die && DO_DEBUG(DBG_SLOW_ACCEPTOR))
VTIM_sleep(2.0);
}
VSL(SLT_Debug, 0, "XXX Accept thread dies %p", ps);
FREE_OBJ(ps);
}
/*--------------------------------------------------------------------
......
......@@ -227,6 +227,7 @@ pool_poolherder(void *priv)
free(ppx->a_stat);
free(ppx->b_stat);
SES_DestroyPool(ppx);
Lck_Delete(&ppx->mtx);
FREE_OBJ(ppx);
VSC_C_main->pools--;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment