]> err.no Git - varnish/commitdiff
Detect and gracefully recover from what appears to be a bug in the FreeBSD
authordes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 15 Feb 2008 07:51:15 +0000 (07:51 +0000)
committerdes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 15 Feb 2008 07:51:15 +0000 (07:51 +0000)
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

index 41933a20a0e1df6acc1361923a2b1aa3058d2af9..94c4ec7a2c1ec146070e791315360660cfc8845b 100644 (file)
@@ -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)