[core] proxy,scgi omit shutdown() to backend (fixes #2743)
commit27f85dbdf43e462c380bb5a738c3bdf90275eeea
authorGlenn Strauss <gstrauss@gluelogic.com>
Sun, 7 Aug 2016 17:09:21 +0000 (7 13:09 -0400)
committerGlenn Strauss <gstrauss@gluelogic.com>
Sun, 7 Aug 2016 17:09:21 +0000 (7 13:09 -0400)
tree324a889af7af639e87def52247425c5964aada5e
parent7e2090b96bcfc001e18d2e49517bc73043e9bb20
[core] proxy,scgi omit shutdown() to backend (fixes #2743)

Due to the POLLHUP behavior triggered on *BSD/Darwin, the shutdown()
had previously been limited to local connections.  If interested in
squeezing the last bits of performance out of a machine, an admin
should configure local connections to be AF_UNIX instead of AF_INET
or AF_INET6 to localhost.  The reason the shutdown() was originally
added in mod_proxy and mod_scgi was to aggressively reduce the number
of potential sockets in TIME_WAIT held by lighttpd.
(See commit:923688d2 "drain backend socket/pipe bufs upon FDEVENT_HUP",
 done for reliability given the aforementioned *BSD/Darwin behavior.)
When using AF_UNIX, the TIME_WAIT issue does not exist, ergo, the
recommendation is to use AF_UNIX for local sockets, when available.
Using AF_UNIX sockets is a better solution to eliminate TIME_WAIT
than is TCP shutdown() half-close which, as we have seen, might not
be handled well by frameworks which are more complex than basic read
request, send response, and close.

x-ref:
  "1.4.40/41 mod_proxy, mod_scgi may trigger POLLHUP on *BSD,Darwin"
  https://redmine.lighttpd.net/issues/2743
src/mod_proxy.c
src/mod_scgi.c