Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
When unable to complete sendfile request, ensure the Processor will be added to the cache only once. Patch by markt.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc8.5.x/trunk@1771857 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
violetagg committed Nov 29, 2016
1 parent cd63c65 commit 16a57bc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
5 changes: 0 additions & 5 deletions java/org/apache/tomcat/util/net/NioEndpoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 0 additions & 2 deletions test/org/apache/catalina/connector/TestSendFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -157,7 +156,6 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
}


@Ignore
@Test
public void testBug60409() throws Exception {
Tomcat tomcat = getTomcatInstance();
Expand Down
4 changes: 4 additions & 0 deletions webapps/docs/changelog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,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">
Expand Down

0 comments on commit 16a57bc

Please sign in to comment.