From: remm Date: Wed, 29 Nov 2006 12:59:22 +0000 (+0000) Subject: - Port back my fixes to this patch. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=d008204e41a1944e2649e90b045704610d63e087;p=tomcat7.0 - Port back my fixes to this patch. - Correctly pass keepalive value to AprEndpoint. - Sendfile should use soTimeout (it's a request, not a keepalive). - Comet poller is also a request in progress so use soTimeout too (most likely it would need its own timeout value). - I will adjust the defaults further, as for example I think keepALiveTimeout should default to soTimeout if not set (ie, if it's -1). git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@480558 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/core/ApplicationFilterChain.java b/java/org/apache/catalina/core/ApplicationFilterChain.java index 0e884db28..36d4c0a1d 100644 --- a/java/org/apache/catalina/core/ApplicationFilterChain.java +++ b/java/org/apache/catalina/core/ApplicationFilterChain.java @@ -529,6 +529,9 @@ final class ApplicationFilterChain implements FilterChain, CometFilterChain { */ void release() { + for (int i = 0; i < n; i++) { + filters[i] = null; + } n = 0; pos = 0; servlet = null; diff --git a/java/org/apache/coyote/ajp/Constants.java b/java/org/apache/coyote/ajp/Constants.java index 68ec5aa7b..f241742bc 100644 --- a/java/org/apache/coyote/ajp/Constants.java +++ b/java/org/apache/coyote/ajp/Constants.java @@ -42,7 +42,7 @@ public final class Constants { public static final int DEFAULT_CONNECTION_LINGER = -1; public static final int DEFAULT_CONNECTION_TIMEOUT = -1; public static final int DEFAULT_CONNECTION_UPLOAD_TIMEOUT = 300000; - public static final int DEFAULT_KEEPALIVE_TIMEOUT = 15000; + public static final int DEFAULT_KEEPALIVE_TIMEOUT = -1; public static final int DEFAULT_SERVER_SOCKET_TIMEOUT = 0; public static final boolean DEFAULT_TCP_NO_DELAY = true; diff --git a/java/org/apache/coyote/http11/Constants.java b/java/org/apache/coyote/http11/Constants.java index 5fafe94e2..d763a6cd1 100644 --- a/java/org/apache/coyote/http11/Constants.java +++ b/java/org/apache/coyote/http11/Constants.java @@ -39,7 +39,7 @@ public final class Constants { public static final int DEFAULT_CONNECTION_LINGER = -1; public static final int DEFAULT_CONNECTION_TIMEOUT = 60000; public static final int DEFAULT_CONNECTION_UPLOAD_TIMEOUT = 300000; - public static final int DEFAULT_KEEPALIVE_TIMEOUT = 15000; + public static final int DEFAULT_KEEPALIVE_TIMEOUT = 60000; public static final int DEFAULT_SERVER_SOCKET_TIMEOUT = 0; public static final boolean DEFAULT_TCP_NO_DELAY = true; diff --git a/java/org/apache/coyote/http11/Http11AprProcessor.java b/java/org/apache/coyote/http11/Http11AprProcessor.java index ef2371b1c..8d05ae792 100644 --- a/java/org/apache/coyote/http11/Http11AprProcessor.java +++ b/java/org/apache/coyote/http11/Http11AprProcessor.java @@ -209,12 +209,6 @@ public class Http11AprProcessor implements ActionHook { */ protected int maxKeepAliveRequests = -1; - /** - * The number of seconds Tomcat will wait for a subsequent request - * before closing the connection. - */ - protected int keepAliveTimeout = 15000; - /** * SSL enabled ? @@ -710,20 +704,6 @@ public class Http11AprProcessor implements ActionHook { return timeout; } - /** - * Set the Keep-Alive timeout. - */ - public void setKeepAliveTimeout(int timeout) { - keepAliveTimeout = timeout; - } - - /** - * Return the number Keep-Alive timeout. - */ - public int getKeepAliveTimeout() { - return keepAliveTimeout; - } - /** * Set the server header name. */ diff --git a/java/org/apache/coyote/http11/Http11AprProtocol.java b/java/org/apache/coyote/http11/Http11AprProtocol.java index 1df4c8217..caf6c378d 100644 --- a/java/org/apache/coyote/http11/Http11AprProtocol.java +++ b/java/org/apache/coyote/http11/Http11AprProtocol.java @@ -202,7 +202,6 @@ public class Http11AprProtocol implements ProtocolHandler, MBeanRegistration private int socketBuffer = 9000; private Adapter adapter; private Http11ConnectionHandler cHandler; - private int keepAliveTimeout = 15000; // 15 seconds as in Apache HTTPD server /** * Compression value. @@ -467,17 +466,14 @@ public class Http11AprProtocol implements ProtocolHandler, MBeanRegistration /** * The number of seconds Tomcat will wait for a subsequent request - * before closing the connection. The default is the same as for - * Apache HTTP Server (15 000 milliseconds). + * before closing the connection. */ - public int getKeepAliveTimeout() - { - return keepAliveTimeout; + public int getKeepAliveTimeout() { + return ep.getKeepAliveTimeout(); } - public void setKeepAliveTimeout(int timeout) - { - keepAliveTimeout = timeout; + public void setKeepAliveTimeout(int timeout) { + ep.setKeepAliveTimeout(timeout); } /** diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java b/java/org/apache/tomcat/util/net/AprEndpoint.java index 5320daab5..9ba4dc89d 100644 --- a/java/org/apache/tomcat/util/net/AprEndpoint.java +++ b/java/org/apache/tomcat/util/net/AprEndpoint.java @@ -260,16 +260,9 @@ public class AprEndpoint { /** * Keep-Alive timeout. */ - protected int keepAliveTimeout = 15000; - public int getKeepAliveTimeout() - { - return keepAliveTimeout; - } - - public void setKeepAliveTimeout(int timeout) - { - keepAliveTimeout = timeout; - } + protected int keepAliveTimeout = -1; + public int getKeepAliveTimeout() { return keepAliveTimeout; } + public void setKeepAliveTimeout(int keepAliveTimeout) { this.keepAliveTimeout = keepAliveTimeout; } /** @@ -1162,7 +1155,7 @@ public class AprEndpoint { if (comet) { // FIXME: Find an appropriate timeout value, for now, "longer than usual" // semms appropriate - timeout = keepAliveTimeout * 50; + timeout = soTimeout * 50; } serverPollset = allocatePoller(size, pool, timeout); if (serverPollset == 0 && size > 1024) { @@ -1576,14 +1569,14 @@ public class AprEndpoint { protected void init() { pool = Pool.create(serverSockPool); int size = sendfileSize / sendfileThreadCount; - sendfilePollset = allocatePoller(size, pool, keepAliveTimeout); + sendfilePollset = allocatePoller(size, pool, soTimeout); if (sendfilePollset == 0 && size > 1024) { size = 1024; - sendfilePollset = allocatePoller(size, pool, keepAliveTimeout); + sendfilePollset = allocatePoller(size, pool, soTimeout); } if (sendfilePollset == 0) { size = 62; - sendfilePollset = allocatePoller(size, pool, keepAliveTimeout); + sendfilePollset = allocatePoller(size, pool, soTimeout); } desc = new long[size * 2]; sendfileData = new HashMap(size);