Author: markt
Date: Fri Aug 4 11:01:28 2017
New Revision: 1804094
URL: http://svn.apache.org/viewvc?rev=1804094&view=rev
Log:
Before generating an error page in the ErrorReportValve, check to see if I/O is
still permitted for the associated connection before generating the error page
so that the page generation can be skipped if the page is never going to be
sent.
Modified:
tomcat/trunk/java/org/apache/catalina/valves/ErrorReportValve.java
tomcat/trunk/webapps/docs/changelog.xml
Modified: tomcat/trunk/java/org/apache/catalina/valves/ErrorReportValve.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/valves/ErrorReportValve.java?rev=1804094&r1=1804093&r2=1804094&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/valves/ErrorReportValve.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/valves/ErrorReportValve.java Fri Aug
4 11:01:28 2017
@@ -19,6 +19,7 @@ package org.apache.catalina.valves;
import java.io.IOException;
import java.io.Writer;
import java.util.Scanner;
+import java.util.concurrent.atomic.AtomicBoolean;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
@@ -149,6 +150,15 @@ public class ErrorReportValve extends Va
if (statusCode < 400 || response.getContentWritten() > 0 ||
!response.setErrorReported()) {
return;
}
+
+ // If an error has occurred that prevents further I/O, don't waste time
+ // producing an error report that will never be read
+ AtomicBoolean result = new AtomicBoolean(false);
+ response.getCoyoteResponse().action(ActionCode.IS_IO_ALLOWED, result);
+ if (!result.get()) {
+ return;
+ }
+
String message = RequestUtil.filter(response.getMessage());
if (message == null) {
if (throwable != null) {
Modified: tomcat/trunk/webapps/docs/changelog.xml
URL:
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1804094&r1=1804093&r2=1804094&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Fri Aug 4 11:01:28 2017
@@ -45,6 +45,16 @@
issues do not "pop up" wrt. others).
-->
<section name="Tomcat 9.0.0.M27 (markt)" rtext="in development">
+ <subsection name="Catalina">
+ <changelog>
+ <fix>
+ Before generating an error page in the <code>ErrorReportValve</code>,
+ check to see if I/O is still permitted for the associated connection
+ before generating the error page so that the page generation can be
+ skipped if the page is never going to be sent. (markt)
+ </fix>
+ </changelog>
+ </subsection>
<subsection name="Coyote">
<changelog>
<fix>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]