hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From George Sofianos <gsf.gre...@gmail.com>
Subject GzipCompressineEntity writeTo creates issues to tomcat?
Date Thu, 03 Nov 2016 16:45:55 GMT
Hi, I'm using HttpComponents httpClient 4.5.2 and I'm really struggling 
with understanding an exception that I recieve from Apache Tomcat. The 
exception is:

org.apache.catalina.connector.ClientAbortException: java.io.IOException: 
APR error: -104

After hours of debugging and thinking, I start to believe the problem is 
coming from HttpComponents HttpClient. The reason is that I'm using an 
ehcache to cache the Http responses, and in turn add the cache in a 
custom CachingHttpClient. Then I'm writing this response to a 
HttpServletResponse in my custom servlet, using the entity.writeTo method.

So when I receive a response from the cache, the response is gzipped, 
and the writeTo method of the GzipCompressingEntity is (I think) is 
creating the following issue:

Because of this issue: 
https://issues.apache.org/jira/browse/HTTPCLIENT-1484 the outputStream 
is being closed by the HttpClient. However, it is the only Entity that 
does so, if I'm reading the source code correctly.

         wrappedEntity.writeTo(gzip);
         // Only close output stream if the wrapped entity has been
         // successfully written out
         gzip.close();

I beleive this APR ClientAbortException on Tomcat is caused by this 
premature closing of the outputstream of the HttpservletResponse. It 
might not be a bug, since it should not matter what Tomcat expects, but 
I thought I should ask / report anyway. I hope my question / comments 
make sense, because I'm still investigating the cause of this issue, and 
I might be completely wrong.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message