https://issues.apache.org/bugzilla/show_bug.cgi?id=48760

           Summary: Tomcat breaks in serving large files (>=1.8MB) under
                    high load and high threading.
           Product: Tomcat 6
           Version: 6.0.16
          Platform: Sun
        OS/Version: Solaris
            Status: NEW
          Severity: major
          Priority: P2
         Component: Catalina
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: arcanef...@gmail.com


When serving a 1.8MB file, Tomcat 6.0.16->6.0.20 (all versions tested), will
occasionally throw a BadFileNumber exception and only serve part of the file.
The rate of occurrence is roughly a few times a day under high load, but we
have stress tools which can reliably reproduce this issue, and multiple
continuous wget connections can reproduce the issue, as well.

We are serving a large SWF application, although this may affect arbitrary
binary data. To reproduce this issue, serve a large file (at least 1.8MB, in
our case), and continuously request the file over a period of several hours to
a few days; this issue happens intermittently, but it is reproducible.

This problem is especially critical to us, as we use apache as a cache in front
of tomcat. For whatever reason, apache aggressively caches this bad data and
never again requests the file, although this is probably another unrelated
problem. In this configuration, however, after the file has gone bad, all users
get served corrupt files, causing the application to break entirely. 

This was reported in 2008 here, but the issue was dismissed:
http://mail-archives.apache.org/mod_mbox/tomcat-dev/200808.mbox/%3cbug-45601...@https.issues.apache.org/bugzilla/%3E

The fix provided here works to resolve the issue, but our IT department cannot
support a custom-rolled version of tomcat indefinitely. It's not a sustainable
solution, and this issue should affect other users. We are not sure why the fix
works, but it does resolve our completely reproducible scenario. Ideally, then,
someone with more knowledge of tomcat could understand why this fix works and
what, exactly, it's solving, and then integrate this into the main tomcat
release line.

Here is how the error appears in the logs:
Feb 16, 2010 1:25:59 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet default threw exception
java.io.IOException: Bad file number
    at java.io.FileInputStream.readBytes(Native Method)
    at java.io.FileInputStream.read(FileInputStream.java:199)
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:256)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
    at java.io.FilterInputStream.read(FilterInputStream.java:90)
    at
org.apache.catalina.servlets.DefaultServlet.copyRange(DefaultServlet.java:1968)
    at
org.apache.catalina.servlets.DefaultServlet.copy(DefaultServlet.java:1714)
    at
org.apache.catalina.servlets.DefaultServlet.serveResource(DefaultServlet.java:809)
    at
org.apache.catalina.servlets.DefaultServlet.doGet(DefaultServlet.java:325)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:568)
    at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at
org.apache.catalina.ha.session.JvmRouteBinderValve.invoke(JvmRouteBinderValve.java:209)
    at
org.apache.catalina.ha.tcp.ReplicationValve.invoke(ReplicationValve.java:347)
    at
org.terracotta.modules.tomcat.tomcat_5_5.SessionValve55.invoke(SessionValve55.java:57)
    at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
    at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:619)

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to