You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2006/11/29 13:59:23 UTC

svn commit: r480558 - in /tomcat/tc6.0.x/trunk/java/org/apache: catalina/core/ coyote/ajp/ coyote/http11/ tomcat/util/net/

Author: remm
Date: Wed Nov 29 04:59:22 2006
New Revision: 480558

URL: http://svn.apache.org/viewvc?view=rev&rev=480558
Log:
- 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).

Modified:
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ApplicationFilterChain.java
    tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/Constants.java
    tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Constants.java
    tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
    tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
    tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ApplicationFilterChain.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ApplicationFilterChain.java?view=diff&rev=480558&r1=480557&r2=480558
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ApplicationFilterChain.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ApplicationFilterChain.java Wed Nov 29 04:59:22 2006
@@ -529,6 +529,9 @@
      */
     void release() {
 
+        for (int i = 0; i < n; i++) {
+            filters[i] = null;
+        }
         n = 0;
         pos = 0;
         servlet = null;

Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/Constants.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/Constants.java?view=diff&rev=480558&r1=480557&r2=480558
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/Constants.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/Constants.java Wed Nov 29 04:59:22 2006
@@ -42,7 +42,7 @@
     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;
 

Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Constants.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Constants.java?view=diff&rev=480558&r1=480557&r2=480558
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Constants.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Constants.java Wed Nov 29 04:59:22 2006
@@ -39,7 +39,7 @@
     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;
     

Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java?view=diff&rev=480558&r1=480557&r2=480558
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java Wed Nov 29 04:59:22 2006
@@ -209,12 +209,6 @@
      */
     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 ?
@@ -708,20 +702,6 @@
      */
     public int getTimeout() {
         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;
     }
 
     /**

Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java?view=diff&rev=480558&r1=480557&r2=480558
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java Wed Nov 29 04:59:22 2006
@@ -202,7 +202,6 @@
     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 @@
                                                                                 
     /**
      * 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);
     }
 
     /**

Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?view=diff&rev=480558&r1=480557&r2=480558
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Wed Nov 29 04:59:22 2006
@@ -260,16 +260,9 @@
     /**
      * 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 @@
             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 @@
         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<Long, SendfileData>(size);



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r480558 - in /tomcat/tc6.0.x/trunk/java/org/apache: catalina/core/ coyote/ajp/ coyote/http11/ tomcat/util/net/

Posted by Mladen Turk <mt...@apache.org>.
Remy Maucherat wrote:
> Mladen Turk wrote:
>>
>> Further more I collected enough votes, so your explanation is useless.
> 
> I am free to commit things, especially since I actually fixed some of 
> your patch. You are free to veto my commit, in which case it would be 
> time to take this to the PMC for resolution, as I would stand by my veto 
> of your original patch unless it is adjusted according to my changes.
>

Of course you are entitled to commit anything, as well as any committer is.
I just wonder what would happen if this would be an *open source* project.

Regards,
Mladen.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r480558 - in /tomcat/tc6.0.x/trunk/java/org/apache: catalina/core/ coyote/ajp/ coyote/http11/ tomcat/util/net/

Posted by Remy Maucherat <re...@apache.org>.
Mladen Turk wrote:
> Look, the keepAliveTimeout defaults to soTimeout.
> 
> Further more I collected enough votes, so your explanation is useless.

The vote was not to have your patch committed verbatim (it is broken), 
but to add a new keepAliveTimeout attribute to control HTTP keep alive 
timeout (= the amount of time between requests). If it's not meant to 
represent this, then the naming is quite bad (and I would be against 
this addition, since I think it would be a confusing configuration 
option). I find the argument that any explanations are useless to be 
very bad.

> So either you'll revert the commits to my patches, or I'll do them.

I would veto a revert (I think the addition of a keepalive timeout is 
obviously not a hugely important feature, but it could be useful in some 
cases - previous configuration only allowed having a keepalive timeout 
which was shorter than the regular socket timeout, and it was not very 
flexible either).

I am free to commit things, especially since I actually fixed some of 
your patch. You are free to veto my commit, in which case it would be 
time to take this to the PMC for resolution, as I would stand by my veto 
of your original patch unless it is adjusted according to my changes.

Rémy

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r480558 - in /tomcat/tc6.0.x/trunk/java/org/apache: catalina/core/ coyote/ajp/ coyote/http11/ tomcat/util/net/

Posted by Mladen Turk <mt...@apache.org>.
Remy Maucherat wrote:
> Mladen Turk wrote:
>> Looks like we can do few things:
>> 1. Revert your patch
>> 2. Revert mine patch
>> 3. Go on and forget all about programming, and do some shepherding.
>>
>> So, please, unless you are going to adopt 3), revert your patch
>> for my patch. You know, Tomcat is not your private backyard,
>> and we have some rules, weather you like them or not.
> 
> Sendfile is for processing the request (sending a file), as a regular 
> servlet does. It is thus normal to use soTimeout, since keepAliveTimeout 
> is the maximum amount of time between requests. It is the same for the 
> comet poller.
> 

Look, the keepAliveTimeout defaults to soTimeout.

Further more I collected enough votes, so your explanation is useless.
So either you'll revert the commits to my patches, or I'll do them.

Regards,
Mladen.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r480558 - in /tomcat/tc6.0.x/trunk/java/org/apache: catalina/core/ coyote/ajp/ coyote/http11/ tomcat/util/net/

Posted by Remy Maucherat <re...@apache.org>.
Mladen Turk wrote:
> Looks like we can do few things:
> 1. Revert your patch
> 2. Revert mine patch
> 3. Go on and forget all about programming, and do some shepherding.
> 
> So, please, unless you are going to adopt 3), revert your patch
> for my patch. You know, Tomcat is not your private backyard,
> and we have some rules, weather you like them or not.

Sendfile is for processing the request (sending a file), as a regular 
servlet does. It is thus normal to use soTimeout, since keepAliveTimeout 
is the maximum amount of time between requests. It is the same for the 
comet poller.

Rémy

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r480558 - in /tomcat/tc6.0.x/trunk/java/org/apache: catalina/core/ coyote/ajp/ coyote/http11/ tomcat/util/net/

Posted by Mladen Turk <mt...@apache.org>.
remm@apache.org wrote:
> Author: remm
> -                timeout = keepAliveTimeout * 50;
> +                timeout = soTimeout * 50;

> -            sendfilePollset = allocatePoller(size, pool, keepAliveTimeout);
> +            sendfilePollset = allocatePoller(size, pool, soTimeout);

> -                sendfilePollset = allocatePoller(size, pool, keepAliveTimeout);
> +                sendfilePollset = allocatePoller(size, pool, soTimeout);

> -                sendfilePollset = allocatePoller(size, pool, keepAliveTimeout);
> +                sendfilePollset = allocatePoller(size, pool, soTimeout);

Beside you changed my patch without asking anyone, you made the
entire patch unusable and pointless.

Looks like we can do few things:
1. Revert your patch
2. Revert mine patch
3. Go on and forget all about programming, and do some shepherding.

So, please, unless you are going to adopt 3), revert your patch
for my patch. You know, Tomcat is not your private backyard,
and we have some rules, weather you like them or not.

Regards,
Mladen.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r480558 - in /tomcat/tc6.0.x/trunk/java/org/apache: catalina/core/ coyote/ajp/ coyote/http11/ tomcat/util/net/

Posted by Remy Maucherat <re...@apache.org>.
> Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ApplicationFilterChain.java
> URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ApplicationFilterChain.java?view=diff&rev=480558&r1=480557&r2=480558
> ==============================================================================
> --- tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ApplicationFilterChain.java (original)
> +++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ApplicationFilterChain.java Wed Nov 29 04:59:22 2006
> @@ -529,6 +529,9 @@
>       */
>      void release() {
>  
> +        for (int i = 0; i < n; i++) {
> +            filters[i] = null;
> +        }
>          n = 0;
>          pos = 0;
>          servlet = null;

BTW, I committed by accident a fix for bug 41034 that I did to submit a 
workaround. I don't know if I'll take it out or not yet.

Rémy

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org