r2462 - trunk/varnish-cache/bin/varnishd

des at projects.linpro.no des at projects.linpro.no
Fri Feb 15 08:51:15 CET 2008


Author: des
Date: 2008-02-15 08:51:15 +0100 (Fri, 15 Feb 2008)
New Revision: 2462

Modified:
   trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c
Log:
Detect and gracefully recover from what appears to be a bug in the FreeBSD
kernel, which will sometimes report a null kqueue event.


Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c	2008-02-13 17:25:57 UTC (rev 2461)
+++ trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c	2008-02-15 07:51:15 UTC (rev 2462)
@@ -219,7 +219,13 @@
 	    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)




More information about the varnish-commit mailing list