Re: ClientAbortException / IOException occurs only when using HttpServletResponseWrapper

2016-09-01 Thread Olivier Jaquemet

On 01/09/2016 08:09, Mark Thomas wrote:

On 31 August 2016 13:22:34 BST, Olivier Jaquemet  
wrote:

Hi all,

We are encountering a weird but frequent exception when users try to
access AVI video playback on IE11.
My analysis is that it's a bad behavior of Tomcat when using
HttpServletResponseWrapper.

I did not want to immediately create a bug report, first because you
might have other insight on the subject, and also because the bug
affects all tomcat version, thus I wanted to be sure on the appropriate

way to report. Indeed the bug report page
(https://tomcat.apache.org/bugreport.html) does not explain what to do
if bugs affect several version of Tomcat. Only enter bug for the latest

version ? Enter bug serval time ? Or maybe there is a way to select
multiple product at once ?

Open one bug against the earliest affected version. Patches, if any, are most 
useful if against trunk.


I have setup a very simple reproduction webapp (2 nearly empty class,
one html, one video) that can be downloaded here :
https://www.dropbox.com/s/q61obn8381hugug/test.war?dl=0   (204.72 KB)

This webapp is configured with a simple servlet filter, doing nothing
special but wrapping the response using a simple
HttpServletResponseWrapper (not doing anything at all) and logging
request information on exception.
To help demonstrate the cause of the problem, the filter expose an init

parameter "wrap-response" in web.xml which quickly allows the webapp to

be tested with 2 behavior : response wrapped (to exhibit the bug) or
not
(to behave properly).
The home page contains a video player with a very small AVI file.

The reproduction steps :
   * Start Tomcat (any version) with the webapp above
   * Access the index page using IE 11 on Windows 7 (very important :
clear browser cache between each test)
   --> The exception at the end of this message occurs.
   * Edit web.xml, set "wrap-response" init parameter to false
   * Repeat the test with IE (don't forget to clear cache!)
   --> No exception.

The problem may be workaround by modifying Tomcat's web.xml by
disabling
Accept-Ranges support.


useAcceptRanges
false


Because the ClientAbortException/IOException does not occurs if the
response is not wrapped, and does not occurs either if acceptRange is
disabled, it really make me think that is a bug in Tomcat (and not a
behavior of the client contrary to what ClientAbortException implies).

Hmm. The dependence on range support makes me want to double check what the 
filter is doing. There was an issue with filters, range support and the default 
servlet several years back.  I need to remind myself of the details.


Bug verified to exist in all following version (with a default install)

(using JDK 1.8.0_102-b14 on Win7 SP1):
  Apache Tomcat/7.0.70
  Apache Tomcat/8.0.36
  Apache Tomcat/8.5.4
  Apache Tomcat/9.0.0.M9

** Should I fill the bug report? and if so, on which product should I
report the bug ? **

Yes. Against 7.0.x unless 6.0.x is affected as well.

I plan to look at this once the current set of releases is complete unless 
someone else beats me to it.

Mark


I could verify that the bug also exists in 6.0.45, thus I have entered 
the following bug report :

https://bz.apache.org/bugzilla/show_bug.cgi?id=60076

Thank you Mark.




Thanks for your help,
Olivier


The exception :
org.apache.catalina.connector.ClientAbortException:
java.io.IOException:
Une connexion établie a été abandonnée par un logiciel de votre
ordinateur hôte
 at
org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:396)
 at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:344)
 at
org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:421)
 at
org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:409)
 at
org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:97)
 at
org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:90)
 at
org.apache.catalina.servlets.DefaultServlet.serveResource(DefaultServlet.java:961)
 at
org.apache.catalina.servlets.DefaultServlet.doGet(DefaultServlet.java:398)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
 at
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
 at com.example.BasicFilter.doFilter(BasicFilter.java:37)
 at

Re: ClientAbortException / IOException occurs only when using HttpServletResponseWrapper

2016-09-01 Thread Mark Thomas
On 31 August 2016 13:22:34 BST, Olivier Jaquemet  
wrote:
>Hi all,
>
>We are encountering a weird but frequent exception when users try to 
>access AVI video playback on IE11.
>My analysis is that it's a bad behavior of Tomcat when using 
>HttpServletResponseWrapper.
>
>I did not want to immediately create a bug report, first because you 
>might have other insight on the subject, and also because the bug 
>affects all tomcat version, thus I wanted to be sure on the appropriate
>
>way to report. Indeed the bug report page 
>(https://tomcat.apache.org/bugreport.html) does not explain what to do 
>if bugs affect several version of Tomcat. Only enter bug for the latest
>
>version ? Enter bug serval time ? Or maybe there is a way to select 
>multiple product at once ?

Open one bug against the earliest affected version. Patches, if any, are most 
useful if against trunk.

>I have setup a very simple reproduction webapp (2 nearly empty class, 
>one html, one video) that can be downloaded here :
>https://www.dropbox.com/s/q61obn8381hugug/test.war?dl=0   (204.72 KB)
>
>This webapp is configured with a simple servlet filter, doing nothing 
>special but wrapping the response using a simple 
>HttpServletResponseWrapper (not doing anything at all) and logging 
>request information on exception.
>To help demonstrate the cause of the problem, the filter expose an init
>
>parameter "wrap-response" in web.xml which quickly allows the webapp to
>
>be tested with 2 behavior : response wrapped (to exhibit the bug) or
>not 
>(to behave properly).
>The home page contains a video player with a very small AVI file.
>
>The reproduction steps :
>   * Start Tomcat (any version) with the webapp above
>   * Access the index page using IE 11 on Windows 7 (very important : 
>clear browser cache between each test)
>   --> The exception at the end of this message occurs.
>   * Edit web.xml, set "wrap-response" init parameter to false
>   * Repeat the test with IE (don't forget to clear cache!)
>   --> No exception.
>
>The problem may be workaround by modifying Tomcat's web.xml by
>disabling 
>Accept-Ranges support.
>
>
>useAcceptRanges
>false
>
>
>Because the ClientAbortException/IOException does not occurs if the 
>response is not wrapped, and does not occurs either if acceptRange is 
>disabled, it really make me think that is a bug in Tomcat (and not a 
>behavior of the client contrary to what ClientAbortException implies).

Hmm. The dependence on range support makes me want to double check what the 
filter is doing. There was an issue with filters, range support and the default 
servlet several years back.  I need to remind myself of the details.

>Bug verified to exist in all following version (with a default install)
>
>(using JDK 1.8.0_102-b14 on Win7 SP1):
>  Apache Tomcat/7.0.70
>  Apache Tomcat/8.0.36
>  Apache Tomcat/8.5.4
>  Apache Tomcat/9.0.0.M9
>
>** Should I fill the bug report? and if so, on which product should I 
>report the bug ? **

Yes. Against 7.0.x unless 6.0.x is affected as well.

I plan to look at this once the current set of releases is complete unless 
someone else beats me to it.

Mark

>Thanks for your help,
>Olivier
>
>
>The exception :
>org.apache.catalina.connector.ClientAbortException:
>java.io.IOException: 
>Une connexion établie a été abandonnée par un logiciel de votre 
>ordinateur hôte
> at 
>org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:396)
> at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:344)
> at 
>org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:421)
> at 
>org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:409)
> at 
>org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:97)
> at 
>org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:90)
> at 
>org.apache.catalina.servlets.DefaultServlet.serveResource(DefaultServlet.java:961)
> at 
>org.apache.catalina.servlets.DefaultServlet.doGet(DefaultServlet.java:398)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
> at 
>org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
> at 
>org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
> at 
>org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
> at 
>org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
> at 
>org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
> at com.example.BasicFilter.doFilter(BasicFilter.java:37)
> at 
>org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
> at 

ClientAbortException / IOException occurs only when using HttpServletResponseWrapper

2016-08-31 Thread Olivier Jaquemet

Hi all,

We are encountering a weird but frequent exception when users try to 
access AVI video playback on IE11.
My analysis is that it's a bad behavior of Tomcat when using 
HttpServletResponseWrapper.


I did not want to immediately create a bug report, first because you 
might have other insight on the subject, and also because the bug 
affects all tomcat version, thus I wanted to be sure on the appropriate 
way to report. Indeed the bug report page 
(https://tomcat.apache.org/bugreport.html) does not explain what to do 
if bugs affect several version of Tomcat. Only enter bug for the latest 
version ? Enter bug serval time ? Or maybe there is a way to select 
multiple product at once ?


I have setup a very simple reproduction webapp (2 nearly empty class, 
one html, one video) that can be downloaded here :

https://www.dropbox.com/s/q61obn8381hugug/test.war?dl=0   (204.72 KB)

This webapp is configured with a simple servlet filter, doing nothing 
special but wrapping the response using a simple 
HttpServletResponseWrapper (not doing anything at all) and logging 
request information on exception.
To help demonstrate the cause of the problem, the filter expose an init 
parameter "wrap-response" in web.xml which quickly allows the webapp to 
be tested with 2 behavior : response wrapped (to exhibit the bug) or not 
(to behave properly).

The home page contains a video player with a very small AVI file.

The reproduction steps :
  * Start Tomcat (any version) with the webapp above
  * Access the index page using IE 11 on Windows 7 (very important : 
clear browser cache between each test)

  --> The exception at the end of this message occurs.
  * Edit web.xml, set "wrap-response" init parameter to false
  * Repeat the test with IE (don't forget to clear cache!)
  --> No exception.

The problem may be workaround by modifying Tomcat's web.xml by disabling 
Accept-Ranges support.


   
   useAcceptRanges
   false
   

Because the ClientAbortException/IOException does not occurs if the 
response is not wrapped, and does not occurs either if acceptRange is 
disabled, it really make me think that is a bug in Tomcat (and not a 
behavior of the client contrary to what ClientAbortException implies).


Bug verified to exist in all following version (with a default install) 
(using JDK 1.8.0_102-b14 on Win7 SP1):

 Apache Tomcat/7.0.70
 Apache Tomcat/8.0.36
 Apache Tomcat/8.5.4
 Apache Tomcat/9.0.0.M9

** Should I fill the bug report? and if so, on which product should I 
report the bug ? **


Thanks for your help,
Olivier


The exception :
org.apache.catalina.connector.ClientAbortException: java.io.IOException: 
Une connexion établie a été abandonnée par un logiciel de votre 
ordinateur hôte
at 
org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:396)

at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:344)
at 
org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:421)
at 
org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:409)
at 
org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:97)
at 
org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:90)
at 
org.apache.catalina.servlets.DefaultServlet.serveResource(DefaultServlet.java:961)
at 
org.apache.catalina.servlets.DefaultServlet.doGet(DefaultServlet.java:398)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at 
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)

at com.example.BasicFilter.doFilter(BasicFilter.java:37)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at 
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at