r2232 - trunk/varnish-cache/bin/varnishd

des at projects.linpro.no des at projects.linpro.no
Thu Nov 8 21:30:07 CET 2007


Author: des
Date: 2007-11-08 21:30:06 +0100 (Thu, 08 Nov 2007)
New Revision: 2232

Modified:
   trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c
Log:
Minimal intervention fix for #162: we can delay arming a kevent, but we
can't delay disarming it, or we will have a race between the acceptor and
a worker thread.  This will need revisiting at some later date.


Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c	2007-11-08 16:52:40 UTC (rev 2231)
+++ trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c	2007-11-08 20:30:06 UTC (rev 2232)
@@ -66,8 +66,8 @@
 	if (sp->fd < 0)
 		return;
 	EV_SET(&ki[nki], sp->fd, EVFILT_READ, arm, 0, 0, sp);
-	if (++nki == NKEV) {
-		assert(kevent(kq, ki, nki, NULL, 0, NULL) <= 0);
+	if (++nki == NKEV || arm == EV_DELETE) {
+		AZ(kevent(kq, ki, nki, NULL, 0, NULL));
 		nki = 0;
 	}
 }




More information about the varnish-commit mailing list