Project

General

Profile

Actions

Bug #2090

closed

mod_proxy_core + mod_proxy_backend_http may leak connections

Added by liming over 14 years ago. Updated almost 8 years ago.

Status:
Obsolete
Priority:
Normal
Category:
mod_proxy_core
Target version:
ASK QUESTIONS IN Forums:

Description

I tried to use mod_proxy_core + mod_proxy_backend_http link lighttpd with apache.
I killed apache and restart it (both lighttpd and apache were serving at the monent, 500 req/s), and I found lighttpd was not stable. Its cpu usage suddenly raised to a high level for a few seconds or even minutes, then falled to normal level, but after some minutes it raised again, and so on.
I shutdown lighttpd, set proxy-core.debug = 1, and did it angain. This time I found lighttpd kept printing "proxy_state_engine: state=6" in its errorlog and never stopped.

At last, I found an interesting thing. When the httpd backend returns an incomplete response, something like
"HTTP/1.1 200 OK\r\nContent-Length: 100\r\n"(obviously it's not finished yet), without any other headers or content-body, lighttpd would keep printing "proxy_state_engine: state=6". The reason is that the leak connections, caused by irregular response, occupy positions in srv->connections and never relase them. As the number of leak connections increases, lighttpd process's cpu usage can be up to 100%.

I suggest treat the incomplete response, which returned by backend httpd server, as a blank page.


Files

diff.txt (261 Bytes) diff.txt liming, 2009-10-24 16:44
mod_proxy_core.diff (261 Bytes) mod_proxy_core.diff liming, 2009-10-24 16:47
mod_proxy_core.diff (546 Bytes) mod_proxy_core.diff liming, 2009-10-28 14:58
Actions #2

Updated by stbuehler over 14 years ago

  • Status changed from Patch Pending to Fixed
  • % Done changed from 0 to 100

Applied in changeset r2677.

Actions #3

Updated by liming over 14 years ago

Hi, I find this patch will cause a new bug, because sess->recv->is_closed is not reset to 0 when return HANDLER_COMEBACK
If you set
proxy-core.backends = ("1.1.1.0:1111", "1.1.1.0:1112")
proxy-core.protocol = "http"
proxy-core.balancer = "static"

1.1.1.0:1111 is not a valid backend, but 1.1.1.0:1112 is a working apache.

First, try 1.1.1.0:1111 and it fails (connection is refused). Second, try 1.1.1.0:1112 and succeeds connecting. However, lighttpd cannot receive any data from apache because sess->recv->is_closed = 1 after 1.1.1.0:1111 fails.

The new patch can fix this bug.

Actions #4

Updated by stbuehler over 9 years ago

  • Assignee deleted (stbuehler)
Actions #5

Updated by gstrauss almost 8 years ago

  • Missing in 1.5.x changed from No to Yes
Actions #6

Updated by gstrauss almost 8 years ago

  • Status changed from Patch Pending to Obsolete
Actions

Also available in: Atom