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 <about...@gmail.com> wrote:
> Hello!
>
> I've got some interesting problem with my own server which use Libevent and
> 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 per
> second.
> Nginx -> statical requests, images
>         -> backend for dynamical requests: Libevent based http server
> 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 problem.
> 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 value
> 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-unsubscr...@freebsd.org"
>
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

Reply via email to