From 2e9a915bc70bd5011ef7e782aefc97968b759b89 Mon Sep 17 00:00:00 2001 From: des Date: Fri, 15 Feb 2008 07:51:15 +0000 Subject: [PATCH] Detect and gracefully recover from what appears to be a bug in the FreeBSD kernel, which will sometimes report a null kqueue event. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2462 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache_acceptor_kqueue.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c b/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c index 41933a20..94c4ec7a 100644 --- a/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c +++ b/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c @@ -219,7 +219,13 @@ vca_kev(const struct kevent *kp) sp, (unsigned long)kp->data, kp->flags, (kp->flags & EV_EOF) ? " EOF" : ""); #endif - assert(sp->fd == kp->ident); + spassert(sp->id == kp->ident); + spassert(sp->fd == sp->id || sp->fd == -1); + if (sp->fd == -1) { + VSL(SLT_Debug, sp->id, "%s(): got event 0x%04x on closed fd", + __func__, kp->fflags); + return; + } if (kp->data > 0) { i = HTC_Rx(sp->htc); if (i == 0) -- 2.39.5