Author: remm Date: Wed Oct 10 17:29:00 2007 New Revision: 583650 URL: http://svn.apache.org/viewvc?rev=583650&view=rev Log: - 43479: Memory leak cleaning up sendfile connections (submitted by the bug reporter). - 42925: No timeout for sendfile (fix TODO item that had been forgotten).
Modified: tomcat/tc6.0.x/trunk/STATUS tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Modified: tomcat/tc6.0.x/trunk/STATUS URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS?rev=583650&r1=583649&r2=583650&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/STATUS (original) +++ tomcat/tc6.0.x/trunk/STATUS Wed Oct 10 17:29:00 2007 @@ -30,16 +30,6 @@ +1: remm, pero, funkman -1: -* 43479: Memory leak cleaning up sendfile connections (submitted by the bug reporter) - http://issues.apache.org/bugzilla/attachment.cgi?id=20883 - +1: remm, pero, funkman - -1: - -* 42925: No timeout for sendfile - http://issues.apache.org/bugzilla/attachment.cgi?id=20930 - +1: remm, pero, funkman - -1: - * Use newer eclipse jdt - old location is gone (reported by Jason Britian via email) update to jdt.loc=http://sunsite.informatik.rwth-aachen.de/eclipse/downloads/drops/R-3.3.1-200709211145/eclipse-JDT-3.3.1.zip +1: pero, funkman, remm @@ -47,9 +37,9 @@ * Call StopAwait at StandardServer.stop as port==-1 +1: pero - -1: + -1: remm (would like clarification on the sleep value, currently 100s) * Arrange doc of connectors. http://people.apache.org/~jfclere/patches/tc.docs.patch - +1: jfclere + +1: jfclere, remm -1: 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?rev=583650&r1=583649&r2=583650&view=diff ============================================================================== --- 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 Oct 10 17:29:00 2007 @@ -1695,7 +1695,7 @@ if (rv == Status.APR_SUCCESS) { sendfileCount--; } - sendfileData.remove(data); + sendfileData.remove(new Long(data.socket)); } /** @@ -1704,6 +1704,7 @@ */ public void run() { + long maintainTime = 0; // Loop until we receive a shutdown command while (running) { @@ -1717,6 +1718,8 @@ } while (sendfileCount < 1 && addS.size() < 1) { + // Reset maintain time. + maintainTime = 0; try { synchronized (this) { this.wait(); @@ -1745,6 +1748,8 @@ addS.clear(); } } + + maintainTime += pollTime; // Pool for the specified interval int rv = Poll.poll(sendfilePollset, pollTime, desc, false); if (rv > 0) { @@ -1810,7 +1815,22 @@ 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.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/tc6.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=583650&r1=583649&r2=583650&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Wed Oct 10 17:29:00 2007 @@ -121,6 +121,12 @@ <update> Cookie parser refactoring, submitted by John Kew. (remm) </update> + <fix> + <bug>43479</bug>: Memory leak cleaning up sendfile connections, submitted by Chris Elving. (remm) + </fix> + <fix> + <bug>42925</bug>: Add maintain for sendfile. (remm) + </fix> </changelog> </subsection> <subsection name="Jasper"> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]