Opened 11 years ago

Last modified 2 years ago

#320 accepted enhancement

nginx should reliably check client connection close with pending data — at Initial Version

Reported by: Sergey Kandaurov Owned by:
Priority: minor Milestone:
Component: nginx-core Version: 1.3.x
Keywords: Cc:
uname -a:
nginx -V: n/a

Description

recv(MSG_PEEK) is the generic way to test when connection was closed.
This works on all platforms, except with pending data.

It is not possible to reliably detect with standard socket interface
if the client connection was closed with pending data. This covers:

  • ssl connection
  • pipelined request

This results in that nginx doesn't drop backend proxy_pass connection
and sockets stay in CLOSE_WAIT state forever.
(It was reported that time can be reduced with proxy_read_timeout.)

To solve this, a hint could be used to indicate EOF event such as:
1) SSL_peek() for https. But that doesn't cover http.
2) OS-provided filter-specific EOF condition on every supported platform:

  • BSD kqueue EV_EOF (already present)
  • Linux epoll
  • ...

References:
http://mailman.nginx.org/pipermail/nginx/2011-June/027669.html
http://mailman.nginx.org/pipermail/nginx/2011-November/030614.html
http://mailman.nginx.org/pipermail/nginx/2013-March/038119.html

Change History (0)

Note: See TracTickets for help on using tickets.