Author: violetagg Date: Tue Nov 29 08:34:19 2016 New Revision: 1771853 URL: http://svn.apache.org/viewvc?rev=1771853&view=rev Log: Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=60409 When unable to complete sendfile request, ensure the Processor will be added to the cache only once. Patch by markt.
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java tomcat/trunk/test/org/apache/catalina/connector/TestSendFile.java tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=1771853&r1=1771852&r2=1771853&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Tue Nov 29 08:34:19 2016 @@ -888,7 +888,6 @@ public class NioEndpoint extends Abstrac // Setup the file channel File f = new File(sd.fileName); if (!f.exists()) { - cancelledKey(sk); return SendfileState.ERROR; } @SuppressWarnings("resource") // Closed when channel is closed @@ -962,16 +961,12 @@ public class NioEndpoint extends Abstrac if (log.isDebugEnabled()) log.debug("Unable to complete sendfile request:", x); if (!calledByProcessor && sc != null) { close(sc, sk); - } else { - cancelledKey(sk); } return SendfileState.ERROR; } catch (Throwable t) { log.error("", t); if (!calledByProcessor && sc != null) { close(sc, sk); - } else { - cancelledKey(sk); } return SendfileState.ERROR; } Modified: tomcat/trunk/test/org/apache/catalina/connector/TestSendFile.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/connector/TestSendFile.java?rev=1771853&r1=1771852&r2=1771853&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/catalina/connector/TestSendFile.java (original) +++ tomcat/trunk/test/org/apache/catalina/connector/TestSendFile.java Tue Nov 29 08:34:19 2016 @@ -39,7 +39,6 @@ import javax.servlet.http.HttpServletRes import static org.junit.Assert.assertEquals; import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; import org.apache.catalina.Context; @@ -157,7 +156,6 @@ public class TestSendFile extends Tomcat } - @Ignore @Test public void testBug60409() throws Exception { Tomcat tomcat = getTomcatInstance(); Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1771853&r1=1771852&r2=1771853&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Tue Nov 29 08:34:19 2016 @@ -167,6 +167,10 @@ removing closed streams from the priority tree to ensure that the tree does not grow too large. (markt) </fix> + <fix> + <bug>60409</bug>: When unable to complete sendfile request, ensure the + Processor will be added to the cache only once. (markt/violetagg) + </fix> </changelog> </subsection> <subsection name="Web applications"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org