Issues with timed out downloads via TomCat?
Posted
by
Ira Baxter
on Pro Webmasters
See other posts from Pro Webmasters
or by Ira Baxter
Published on 2011-12-05T18:46:07Z
Indexed on
2012/04/08
5:47 UTC
Read the original article
Hit count: 533
We get, in our opinion, a lot of failed download attempts and want to understand why.
We offer downloads via an email link (typical):
http://www.semanticdesigns.com/deliverEval/<productname>
This is processed by Tomcat on Linux via a jsp file, with the following code:
response.addHeader( "Content-Disposition", "attachment; filename=" + fileTail );
response.addHeader( "Content-Type", "application/x-msdos-program" );
byte[] buf = new byte[8192];
int read;
try {
java.io.FileInputStream input = new java.io.FileInputStream( filename );
java.io.OutputStream o = response.getOutputStream();
while( ( read = input.read( buf, 0, 8192 ) ) != -1 ){
o.write( buf, 0, read );
}
o.flush();
} catch( Exception e ){
util.fatalError( request.getRequestURI(), "Error sending file '" + filename + "' to client", e );
throw e;
}
We get a lot of reported errors (about 50% error rate):
URI
---
/deliverEval/download.jsp
Code Message: Error sending file '/home/sd/ShippingMasters/DMS/Domains/C/GCC3/Tools/TestCoverage/SD_C~GCC3_TestCoverage.1.6.12.exe' to client
Stack Trace
-----------
null
at org.apache.coyote.tomcat5.OutputBuffer.realWriteBytes(byte[], int, int) (Unknown Source)
at org.apache.tomcat.util.buf.ByteChunk.append(byte[], int, int) (Unknown Source)
at org.apache.coyote.tomcat5.OutputBuffer.writeBytes(byte[], int, int) (Unknown Source)
at org.apache.coyote.tomcat5.OutputBuffer.write(byte[], int, int) (Unknown Source)
at org.apache.coyote.tomcat5.CoyoteOutputStream.write(byte[], int, int) (Unknown Source)
at org.apache.jsp.deliverEval.download_jsp._jspService(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) (Unknown Source)
at org.apache.jasper.runtime.HttpJspBase.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) (Unknown Source)
at javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) (Unknown Source)
at org.apache.jasper.servlet.JspServletWrapper.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, boolean) (Unknown Source)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String, java.lang.Throwable, boolean) (Unknown Source)
at org.apache.jasper.servlet.JspServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) (Unknown Source)
at javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) (Unknown Source)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) (Unknown Source)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) (Unknown Source)
at org.apache.catalina.core.StandardWrapperValve.invoke(org.apache.catalina.Request, org.apache.catalina.Response, org.apache.catalina.ValveContext) (Unknown Source)
We don't understand why this rate should be so high. Is there any way to get more information about the cause of the error?
It is useful to know that these are pretty big documents, 3-50 megabytes. They reside on the Linux server so reading them is just a local disk read, and is unlikely to be a contributor to the problem. But sheer size might be an issue for the recipients browser?
Is this kind of error rate typical for downloads? My personal experience downloading other's documents suggests no; our internal attempts show this to be very reliable, but we're operating on our internal network for such experiments so we're missing the complexity of the intervening internet.
© Pro Webmasters or respective owner