phk at phk.freebsd.dk
Mon Aug 21 10:32:50 CEST 2006
In message <13126.96.36.199.102.1156145019.squirrel at denise.vg.no>, "Anders Berg
>I have recently looked a little at Lighttpd. It is an eventdriven
>webserver much like us.
>I guess a quick look on the kqueue and sessionclosing part can give us
>some possibly valuable hint's as to what we may be doing different.
>Lighttpd has been around for some time and probably has all those quirks
I think I have kqueue licked now.
The problem was that I assumed that the changelist as applied atomically
with respect to other threads on the same kqueue, but it isn't, it's
applied one change at a time.
So when a session had been services and came back, I would add to
kevents: A reader and a timer. The reader would get applied, and
trigger instantly, the acceptor would get the event, conclude that
the session was closed, and delete the two kevents any session
has when in the acceptor.
Except the first thread had not gotten around to add the timer
kevent yet, so removing it would fail and then it would get added
after the corresponding session was destroyed by the acceptor.
Now I add the timer kevent first and everything is happy.
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-dev