You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2008/01/06 22:56:24 UTC

svn commit: r609420 - in /tomcat: connectors/trunk/util/java/org/apache/tomcat/util/net/AprEndpoint.java container/tc5.5.x/webapps/docs/changelog.xml current/tc5.5.x/STATUS.txt

Author: markt
Date: Sun Jan  6 13:56:24 2008
New Revision: 609420

URL: http://svn.apache.org/viewvc?rev=609420&view=rev
Log:
Fix bug 43995 (no timeout) and port fix for 43479 (mem leak).

Modified:
    tomcat/connectors/trunk/util/java/org/apache/tomcat/util/net/AprEndpoint.java
    tomcat/container/tc5.5.x/webapps/docs/changelog.xml
    tomcat/current/tc5.5.x/STATUS.txt

Modified: tomcat/connectors/trunk/util/java/org/apache/tomcat/util/net/AprEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/util/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=609420&r1=609419&r2=609420&view=diff
==============================================================================
--- tomcat/connectors/trunk/util/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
+++ tomcat/connectors/trunk/util/java/org/apache/tomcat/util/net/AprEndpoint.java Sun Jan  6 13:56:24 2008
@@ -1460,7 +1460,7 @@
             if (rv == Status.APR_SUCCESS) {
                 sendfileCount--;
             }
-            sendfileData.remove(data);
+            sendfileData.remove(new Long(data.socket));
         }
 
         /**
@@ -1469,6 +1469,7 @@
          */
         public void run() {
 
+            long maintainTime = 0;
             // Loop until we receive a shutdown command
             while (running) {
 
@@ -1482,6 +1483,8 @@
                 }
 
                 while (sendfileCount < 1 && addS.size() < 1) {
+                    // Reset maintain time.
+                    maintainTime = 0;
                     try {
                         synchronized (this) {
                             this.wait();
@@ -1510,6 +1513,8 @@
                             addS.clear();
                         }
                     }
+
+                    maintainTime += pollTime;
                     // Pool for the specified interval
                     int rv = Poll.poll(sendfilePollset, pollTime, desc, false);
                     if (rv > 0) {
@@ -1573,7 +1578,23 @@
                             continue;
                         }
                     }
-                    /* TODO: See if we need to call the maintain for sendfile poller */
+                    // Call maintain for the sendfile poller
+                    if (soTimeout > 0 && maintainTime > 1000000L && running) {
+                        rv = Poll.maintain(sendfilePollset, desc, true);
+                        maintainTime = 0;
+                        if (rv > 0) {
+                            for (int n = 0; n < rv; n++) {
+                                // Get the sendfile state
+                                SendfileData state =
+                                    (SendfileData) sendfileData.get(new Long(desc[n]));
+                                // Close socket and clear pool
+                                remove(state);
+                                // Destroy file descriptor pool, which should close the file
+                                // Close the socket, as the response would be incomplete
+                                Socket.destroy(state.socket);
+                            }
+                        }
+                    }
                 } catch (Throwable t) {
                     log.error(sm.getString("endpoint.poll.error"), t);
                 }

Modified: tomcat/container/tc5.5.x/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/webapps/docs/changelog.xml?rev=609420&r1=609419&r2=609420&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/webapps/docs/changelog.xml (original)
+++ tomcat/container/tc5.5.x/webapps/docs/changelog.xml Sun Jan  6 13:56:24 2008
@@ -126,6 +126,18 @@
       </fix>
     </changelog>
   </subsection>
+  <subsection name="Coyote" >
+    <changelog>
+      <fix>
+        <bug>43479</bug>: Fix memory leak cleaning up sendfile connections.
+        (markt)
+      </fix>
+      <fix>
+        <bug>43995</bug>: No timeout for sendfile (TODO item had been
+        forgotten). (markt)
+      </fix>
+    </changelog>
+  </subsection>
 </section>
      
 <section name="Tomcat 5.5.25 (fhanik)">

Modified: tomcat/current/tc5.5.x/STATUS.txt
URL: http://svn.apache.org/viewvc/tomcat/current/tc5.5.x/STATUS.txt?rev=609420&r1=609419&r2=609420&view=diff
==============================================================================
--- tomcat/current/tc5.5.x/STATUS.txt (original)
+++ tomcat/current/tc5.5.x/STATUS.txt Sun Jan  6 13:56:24 2008
@@ -47,13 +47,6 @@
   -1:
    0: fhanik, this needs to be reworked completely, so I'm neutral
 
-* Fix http://issues.apache.org/bugzilla/show_bug.cgi?id=43995
-  Backport fix from TC6. Also fix memory leak
-  http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?view=diff&r1=583649&r2=583650&pathrev=583650
-  +1: markt, pero, fhanik
-  -1:
-
-
 * Fix http://issues.apache.org/bugzilla/show_bug.cgi?id=43622
   Don't always overwrite min compression size with default
   http://svn.apache.org/viewvc?rev=599914&view=rev



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