Hi folks. Jason Hunter suggested I send this notice to the list, so here it is.
----- Forwarded by Matt Cowley/Providersolutions on 03/29/02 04:33 PM ----- Matt Cowley To: [EMAIL PROTECTED] 03/26/02 cc: 03:04 PM Subject: MultipartRequest upload failing with large files Hi folks. We're having problems uploading large files with the OReilly MultipartRequest class when using ssl. Files under 10mb work fine. If we upload more than that (in one large file or a combination of smaller ones), we get an Array Index Out of Bounds exception (dump follows). This only happens going through ssl; non-secure uploads work fine with very large files. I found a very similar bug report on the servlets.com site (description follows), and upgraded to the 19-Jun-2001 version of the com.oreilly.servlet package. Same symptoms after the upgrade. Any ideas or help would be most appreciated. Thanks. -matt Environment: ------------ - Win2000 Server, patched up to latest levels - Tomcat 4.0.1 Binary distribution, running as a service - IIS 5.0, using ISAPI_Redirect.dll dated 12/08/01 (Thank you Henri Gomez!) - SSL Enabled through IIS - I have several servers with similar environments. Some servers have multiple logical web servers with multiple Tomcat instances. This particular server has only one instance of each. However, the same behavior is observed on any server/instance with SSL. Facts: ------ 1] This only happens on https://, all other forms work fine. 2] This only happens on files larger than just under 11MB (11,172,378 bytes, plus or minus a few bytes for filename payload). 3] The "Assert Failed" error comes from Ajp13.java, Ajp13Packet.java, or MsgAjp.java. I am not a Java programmer (yes, another one of those 'systems' guys), but was able to dig throught the source to find the actual system.out lines. 4] 11,172,378 / 1364 = 8191+-, the same size as the ajp packet. Why 1364 ajp packets? Anything smaller works fine. Here's the bug report from servlets.com: Bug: File upload does not work with Apache JServ when uploading large binary files Symptoms: When handling a file upload the com.oreilly.servlet.MultipartRequest class throws an ArrayIndexOutOfBoundsException. Reason: JServ supports the older Servlet API 2.0 and in the API 2.0 source code for javax.servlet.ServletInputStream there's a bug in the readLine(byte[] buf, int off, int len) method where the len parameter is ignored, and as a result reading input lines that exceed the buf length will throw an ArrayIndexOutOfBoundsException. Workaround: The com.oreilly.servlet library has implemented its own buffering to work around this issue. If you're using another library, upgrade to a server that supports Servlet API 2.1 or later. Here's the exception dump: 14:24:22,311 [Ajp13Processor[8009][24]] ERROR com.psc.ams.servlets.PSCUploadFilesByExtension - Unexpected Exception occured in PSCUploadFiles.doPost(). java.lang.ArrayIndexOutOfBoundsException at java.lang.System.arraycopy(Native Method) at org.apache.ajp.Ajp13Packet.getBytes(Ajp13Packet.java:459) at org.apache.ajp.Ajp13.refillReadBuffer(Ajp13.java:641) at org.apache.ajp.Ajp13.doRead(Ajp13.java:594) at org.apache.ajp.tomcat4.Ajp13InputStream.read(Ajp13InputStream.java:99) at com.oreilly.servlet.multipart.BufferedServletInputStream.fill(BufferedServletInputStream.java:63) at com.oreilly.servlet.multipart.BufferedServletInputStream.readLine(BufferedServletInputStream.java:107) at com.oreilly.servlet.multipart.LimitedServletInputStream.readLine(LimitedServletInputStream.java:59) at com.oreilly.servlet.multipart.PartInputStream.fill(PartInputStream.java:92) at com.oreilly.servlet.multipart.PartInputStream.read(PartInputStream.java:190) at com.oreilly.servlet.multipart.PartInputStream.read(PartInputStream.java:151) at com.oreilly.servlet.multipart.FilePart.write(FilePart.java:186) at com.oreilly.servlet.multipart.FilePart.writeTo(FilePart.java:145) at com.oreilly.servlet.MultipartRequest.<init>(MultipartRequest.java:139) at com.psc.ams.servlets.PSCUploadFilesByExtension.doPost(PSCUploadFilesByExtension.java:480) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.valves.RequestDumperValve.invoke(RequestDumperValve.java:221) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.ajp.tomcat4.Ajp13Processor.process(Ajp13Processor.java:371) at org.apache.ajp.tomcat4.Ajp13Processor.run(Ajp13Processor.java:424) at java.lang.Thread.run(Thread.java:484) -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>