Client abort detection w/ upstream broken on anything but kqueue ()?

Marcello Barnaba marcello.barnaba at gmail.com
Wed Nov 3 00:14:34 MSK 2010


Hello,

  I'm investigating why client aborts are successfully detected
by nginx when using kqueue () on BSD systems and not when using
poll () on BSD & Linux or epoll () on Linux systems.

  I've done debug sessions and I nailed down the problem to the
ngx_http_upstream_check_broken_connection function, line 917 of
http/ngx_http_upstream.c of release 0.8.53.

  From my tests on a Darwin 10.4.0 using poll () and on a Linux
2.6.32 using epoll () a client that closes its socket makes the
recv () on line 994 return 1, with errno set to EWOULDBLOCK on
Darwin/poll () and to EAGAIN on Linux/epoll ().

  I've tried to change the condition at line 1016 from n > 0 to
(n > 0 && err != NGX_EAGAIN && err != NGX_EWOULDBLOCK) but I'm
sure it doesn't make much sense.

  Is this a known issue? From where should I start to solve it?

Thank you,

~Marcello
-- 
~ marcello.barnaba at gmail.com
~ http://www.linkedin.com/in/marcellobarnaba
~ http://sindro.me/







More information about the nginx mailing list