From: Christos Tsantilas Date: Tue, 27 Jan 2009 21:51:41 +0000 (+0200) Subject: Author: Alex Rousskov X-Git-Tag: SQUID_3_2_0_1~1236 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7828df5b831e83ae192c60dc99e2877eb9df5505;p=thirdparty%2Fsquid.git Author: Alex Rousskov Bug 2505: assertion failed: comm.cc:1727: "p == call" Do not assert that the close handler being removed must be in the list because comm_close removes all close handlers before any FD handlers are fired. There also seems to be an unrelated(?) problem: comm_remove_close_handler does not really remove the callback. It only cancels the call. It should probably remove the callback as well to prevent an unlikely situation where the close handler list grows "too much". --- diff --git a/src/comm.cc b/src/comm.cc index e4a079243f..1c965de003 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -1690,8 +1690,11 @@ comm_remove_close_handler(int fd, PF * handler, void *data) if (call->dialer.handler == handler && params.data == data) break; /* This is our handler */ } - assert(p != NULL); - p->cancel("comm_remove_close_handler"); + + // comm_close removes all close handlers so our handler may be gone + if (p != NULL) + p->cancel("comm_remove_close_handler"); + // TODO: should we remove the handler from the close handlers list? } // remove method-based close handler @@ -1699,14 +1702,17 @@ void comm_remove_close_handler(int fd, AsyncCall::Pointer &call) { assert (isOpen(fd)); - /* Find handler in list */ debugs(5, 5, "comm_remove_close_handler: FD " << fd << ", AsyncCall=" << call); + // comm_close removes all close handlers so our handler may be gone + // TODO: should we remove the handler from the close handlers list? +#if 0 // Check to see if really exist the given AsyncCall in comm_close handlers // TODO: optimize: this slow code is only needed for the assert() below AsyncCall::Pointer p; for (p = fd_table[fd].closeHandler; p != NULL && p != call; p = p->Next()); assert(p == call); +#endif call->cancel("comm_remove_close_handler"); }