r2232 - trunk/varnish-cache/bin/varnishd

Poul-Henning Kamp phk at phk.freebsd.dk
Thu Nov 8 21:48:15 CET 2007

In message <20071108203007.3091F1EC872 at projects.linpro.no>, des at projects.linpro
.no writes:
>Author: des
>Date: 2007-11-08 21:30:06 +0100 (Thu, 08 Nov 2007)
>New Revision: 2232
>   trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c
>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.

More thinking:

If we get two events for the fd in the same batch, this fix will
not save us.  I'm not sure if FreeBSD's current kqueue implementation
prevents that from happening.

Long term and full fix: we should mark the session with a flag
instead and ignore events when we don't own the session.  Trouble
with that is, we need to hold a ref on the session to check the

There are other things in the acceptor-end of varnish that needs
revisited, for now this fix is plenty.

Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.

More information about the varnish-commit mailing list