From fa70ec98e848d587bc62beebabfcb6c96f67248f Mon Sep 17 00:00:00 2001 From: Angus Salkeld Date: Tue, 3 Jan 2012 13:48:14 +1100 Subject: [PATCH] IPC: remove fd from poll loop in the disconnect Until now we have been relying on getting a POLLHUP, but under heavy load we seem to get an old poll event that cause a double deref of the connection object. Signed-off-by: Angus Salkeld --- lib/ipcs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/ipcs.c b/lib/ipcs.c index 0710301..5a39e43 100644 --- a/lib/ipcs.c +++ b/lib/ipcs.c @@ -499,6 +499,7 @@ qb_ipcs_disconnect(struct qb_ipcs_connection *c) c->state = QB_IPCS_CONNECTION_INACTIVE; c->service->stats.closed_connections++; if (c->service->needs_sock_for_poll && c->setup.u.us.sock > 0) { + (void)c->service->poll_fns.dispatch_del(c->setup.u.us.sock); qb_ipcc_us_sock_close(c->setup.u.us.sock); c->setup.u.us.sock = -1; qb_ipcs_connection_unref(c); @@ -510,6 +511,7 @@ qb_ipcs_disconnect(struct qb_ipcs_connection *c) c->service->stats.closed_connections++; if (c->service->needs_sock_for_poll && c->setup.u.us.sock > 0) { + (void)c->service->poll_fns.dispatch_del(c->setup.u.us.sock); qb_ipcc_us_sock_close(c->setup.u.us.sock); c->setup.u.us.sock = -1; qb_ipcs_connection_unref(c);