diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java
index e2e23ea18331..34e8a69d4798 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -888,7 +888,6 @@ public SendfileState processSendfile(SelectionKey sk, NioSocketWrapper socketWra
// 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 SendfileState processSendfile(SelectionKey sk, NioSocketWrapper socketWra
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;
}
diff --git a/test/org/apache/catalina/connector/TestSendFile.java b/test/org/apache/catalina/connector/TestSendFile.java
index e7c74d10032c..47b32092393b 100644
--- a/test/org/apache/catalina/connector/TestSendFile.java
+++ b/test/org/apache/catalina/connector/TestSendFile.java
@@ -39,7 +39,6 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
-import org.junit.Ignore;
import org.junit.Test;
import org.apache.catalina.Context;
@@ -157,7 +156,6 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
}
- @Ignore
@Test
public void testBug60409() throws Exception {
Tomcat tomcat = getTomcatInstance();
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 56efa99fb097..ccfb524d212a 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -140,6 +140,10 @@
removing closed streams from the priority tree to ensure that the tree
does not grow too large. (markt)
+
+ 60409: When unable to complete sendfile request, ensure the
+ Processor will be added to the cache only once. (markt/violetagg)
+