Bug #1178
mod_proxy_core + tomcat = hanging requests
| Status: | Fixed | Start: | ||
| Priority: | Normal | Due date: | ||
| Assigned to: | - | % Done: | 0% |
|
| Category: | mod_proxy_core | |||
| Target version: | 1.5.0 | |||
| Pending: | No |
Resolution: | fixed |
|
Description
i have observed the following with both lighttpd 1854 (current trunk) and 1811.
i'm using mod_proxy_core to connect to a single instance of tomcat 6.0.10 using
the following config:
$HTTP["url"] !~ "^/img/" {
proxy-core.max-pool-size = 20
proxy-core.protocol = "http"
proxy-core.balancer = "sqf"
proxy-core.backends = ( "127.0.0.1:8080" )
}
this seems to work at first glance but about 1 out of 4 responses gets a literal '0' appended
(visible in the browser at the end of page) and the connection hangs - apparently until some timeout is hit.
i played with various settings such as proxy-core.max-pool-size = 1, http11 = disable and also
disabled keep-alive in tomcat entirely (maxKeepAliveRequests = 1). none of my tweaks could make the problem go away, some made it even worse.
i'll have to go back to 1.4.x and mod_proxy for now but would be glad if someone
could look into this...
History
05/14/2007 09:47 AM - Anonymous
I would suggest to use AJP13 protocol with Tomcat instead of proxying HTTP requests.
At least we've successfully run almost half a year Tomcat with AJP13 with lighty 1.5-x trunk.
-- jtiai
11/12/2007 04:05 PM - Anonymous
We have exactly same problem.
BTW AJP13 seems to work much slower then HTTP proxy.
11/12/2007 07:33 PM - moe
Well, we're not using tomcat anymore (left the java-world, it's all fastcgi now) but I
wonder if this is a bug in the mod_proxy_core http backend or if it's a particular problem
with tomcat.
Is anyone using the http backend for anything other than tomcat (or a servlet engine)?
Do you see the same problem?
It smells like a classic off-by-one bug to me.
11/12/2007 07:51 PM - stepancheg
Oops, trac didn't save my comment. Typing again.
mod_proxy_backend_http does not interpret 304 response properly: it always tries to read http message body. 304 requires response has no message body. So Tomcat does not send either "content-length" or "transfer-encoding: chunked" headers. So mod_proxy_backend_http reads until EOF, i. e. hangs.
I tried to
11/12/2007 07:52 PM - stepancheg
diff again:
--- mod_proxy_backend_http.c.orig 2007-11-12 22:42:14.000000000 +0300
+++ mod_proxy_backend_http.c 2007-11-12 22:23:50.000000000 +0300
@@ -226,38 +226,42 @@
PROXY_STREAM_DECODER_FUNC(proxy_http_stream_decoder) {
proxy_connection *proxy_con = sess->proxy_con;
chunkqueue *in = proxy_con->recv;
chunk *c;
if (in->first == NULL) {
if ((sess->content_length >= 0 && sess->bytes_read == sess->content_length) || in->is_closed) {
sess->is_request_finished = 1;
return HANDLER_FINISHED;
}
return HANDLER_GO_ON;
}
/* parse response headers. */
if (!sess->have_response_headers) {
handler_t rc = proxy_http_parse_response_headers(sess, in);
if (rc != HANDLER_FINISHED) return rc;
}
+
+ if (sess->resp->status == 304) {
+ return HANDLER_FINISHED;
+ }
if (sess->is_chunked) {
return proxy_http_parse_chunked_stream(srv, sess, in, out);
} else {