Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Aug 2011 19:10:51 +0800
From:      Adrian Chadd <adrian@freebsd.org>
To:        about bus <aboutbus@gmail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Kqueue + Libevent
Message-ID:  <CAJ-Vmom1MMvFxwRyBvxRuhEdsLWuORDD8TbL5WEzu-pkU=wjDQ@mail.gmail.com>
In-Reply-To: <CAPgCMdUW4pQcq1m93npCiyN7g4vXeGt_oQuMsUrBcOF8o4KuEw@mail.gmail.com>
References:  <CAPgCMdUW4pQcq1m93npCiyN7g4vXeGt_oQuMsUrBcOF8o4KuEw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
I've not seen this happen before, are you sure that libevent's kqueue
code is properly removing all the pending events for a given FD when
it's closed?



Adrian

On 19 August 2011 18:33, about bus <aboutbus@gmail.com> wrote:
> Hello!
>
> I've got some interesting problem with my own server which use Libevent a=
nd
> Kqueue.
> Kqueue holds some sockets for a long time (while reading data) and gives =
it
> back to application when another side closes connection.
>
> I have server with FreeBSD 7.2 which serves several thousands requests pe=
r
> second.
> Nginx -> statical requests, images
> =A0 =A0 =A0 =A0 -> backend for dynamical requests: Libevent based http se=
rver
> written on C
>
> Sometimes, about 0.1% of request, Nginx displays error: "Operation timed =
out
> while reading response from upstream."
> Switching Libevent from Kqueue to Poll in my http server fixes the proble=
m.
> Poll works fine without errors in Nginx log file.
>
> Debug output for timeouted requests from Libevent:
> 1) Libevent accepts incoming connection from Nginx.
> 2) Libevent adds socket to Kqueue for waiting incoming data with HTTP
> request.
> 3) No events on socket for 60 seconds, no received data. (60 - timeout va=
lue
> in Nginx config)
> 4) On the another side Nginx closes connection and displays timeout error=
.
> 5) At the same time Kqueue reports about incoming data and returns socket=
 to
> Libevent.
> 6) Libevent reads correct HTTP request from socket and passes it to my
> handler.
>
> Why Kqueue does not reports about read event for so long time?
> Why Kqueue do it only when another side closes connection?
> It is strange, because Poll does not have such problems.
> _______________________________________________
> freebsd-hackers@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org=
"
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-Vmom1MMvFxwRyBvxRuhEdsLWuORDD8TbL5WEzu-pkU=wjDQ>