You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Søren Neigaard <ne...@e-box.dk> on 2002/03/27 09:09:07 UTC

Re[2]: How to POST very large data to Servlet? (a question about ServletRequest.getInputStream)

Hi John

I have no idea if you problem is the same as mine, but I have had
similar problems, and I eventually fixed it by enlarging the heap and
stack memory parameter for the JVM.

As said, I don't know if it will help you, but it did help me :)

/Søren

Tuesday, March 26, 2002, 10:36:40 PM, John wrote:

JR> Note: Repost of Assert failed, buff too small.

JR> We are currently troubleshooting a problem (originally posted last week
JR> 3/20/02) relating to this same issue.  Our application uploads data using an
JR> HTTP POST.  Directly to Tomcat or with HTTP, it works fine.  With HTTPS,
JR> ajp13.java reports "Assert Failed, buff too small", and then the application
JR> produces an exception.  We are using the O'Reilly servlet with our
JR> environment, outlined below.  Anyone with any assistance would be
JR> appreciated.

JR> -----Original Message-----
JR> We are having a problem with Tomcat using an upload servlet to upload
JR> potentially large files (up to 100MB).  The servlet works fine for all file
JR> sizes in the following instances:
JR> http://servername/app/UploadFiles.jsp
JR> http://servername:8080/app/UploadFiles.jsp
JR> but when using https (ie: https://servername/app/UploadFiles.jsp, we get
JR> 'Page Cannot Be Displayed'.  A summary of the error logs is below:

JR> IIS_Redirect.Log
JR> ----------------
JR>  [Wed Mar 20 15:49:20 2002]  [jk_ajp13_worker.c (206)]: sending to ajp13
JR> #8192
JR>  [Wed Mar 20 15:49:20 2002]  [jk_ajp13_worker.c (258)]: received from ajp13
JR> #3
JR>  [Wed Mar 20 15:49:20 2002]  [jk_isapi_plugin.c (426)]: Into
JR> jk_ws_service_t::read
JR>  [Wed Mar 20 15:49:20 2002]  [jk_isapi_plugin.c (426)]: Into
JR> jk_ws_service_t::read

JR>  ... this repeats 1364 times, everytime, before the following: ...

JR>  [Wed Mar 20 15:49:20 2002]  [jk_ajp13_worker.c (206)]: sending to ajp13
JR> #8192
JR>  [Wed Mar 20 15:49:20 2002]  [jk_ajp13_worker.c (258)]: received from ajp13
JR> #3
JR>  [Wed Mar 20 15:49:20 2002]  [jk_isapi_plugin.c (426)]: Into
JR> jk_ws_service_t::read
JR>  [Wed Mar 20 15:49:20 2002]  [jk_isapi_plugin.c (426)]: Into
JR> jk_ws_service_t::read
JR>  [Wed Mar 20 15:49:20 2002]  [jk_isapi_plugin.c (460)]:
JR> jk_ws_service_t::read, ReadClient failed

JR> stdout.log
JR> ----------
JR>  Starting service Tomcat-Standalone-(Staging)
JR>  Apache Tomcat/4.0.1
JR>  [Ajp13] bad read: -103
JR>  XXX Assert failed, buff too small

JR> Note: Yes, I have been following the list, and I don't know what causes -103
JR> either, but with the exception of this servlet, our app has been running
JR> great for months, with several dozen -103's a day.  The XXX Assert Failed is
JR> new.

JR> tomcat_log.log
JR> --------------
JR> 2002-03-20 15:34:02 UploadFiles: init
JR> 2002-03-20 15:34:15 jsp: init
JR> 2002-03-20 15:34:15 Ajp13Processor[8009][6] process: invoke
JR> java.net.SocketException: Connection aborted by peer: socket write error
JR>         at java.net.SocketOutputStream.socketWrite(Native Method)
JR>         at java.net.SocketOutputStream.write(SocketOutputStream.java:83)
JR>         at org.apache.ajp.Ajp13.send(Ajp13.java:959)
JR>         at org.apache.ajp.Ajp13.finish(Ajp13.java:808)
JR>         at
JR> org.apache.ajp.tomcat4.Ajp13Response.finishResponse(Ajp13Response.java:192)
JR>         at org.apache.ajp.tomcat4.Ajp13Processor.process(Ajp13Processor.java:373)
JR>         at org.apache.ajp.tomcat4.Ajp13Processor.run(Ajp13Processor.java:424)
JR>         at java.lang.Thread.run(Thread.java:484)

JR> Application Log
JR> ---------------
JR> 2002-03-20 15:34:03,253 [Ajp13Processor[8009][6]] DEBUG
JR> com.psc.ams.servlets.PSCUploadFilesByExtension - clearing dir
JR> e:/****/staging\jroth
JR> 2002-03-20 15:34:03,253 [Ajp13Processor[8009][6]] DEBUG
JR> com.psc.ams.servlets.PSCUploadFilesByExtension - attempting to delete file
JR> e:\****\staging\jroth\11MB.txt
JR> 2002-03-20 15:34:15,190 [Ajp13Processor[8009][6]] ERROR
JR> com.psc.ams.servlets.PSCUploadFilesByExtension - Unexpected Exception
JR> occured in PSCUploadFiles.doPost().
JR> java.lang.ArrayIndexOutOfBoundsException
JR>         at java.lang.System.arraycopy(Native Method)
JR>         at org.apache.ajp.Ajp13Packet.getBytes(Ajp13Packet.java:459)
JR>         at org.apache.ajp.Ajp13.refillReadBuffer(Ajp13.java:641)
JR>         at org.apache.ajp.Ajp13.doRead(Ajp13.java:540)
JR>         at org.apache.ajp.tomcat4.Ajp13InputStream.read(Ajp13InputStream.java:95)
JR>         at javax.servlet.ServletInputStream.readLine(ServletInputStream.java:138)
JR>         at
JR> com.oreilly.servlet.MultipartInputStreamHandler.readLine(MultipartInputStrea
JR> mHandler.java:63)
JR>         at
JR> com.oreilly.servlet.MultipartRequest.readAndSaveFile(MultipartRequest.java:4
JR> 21)
JR>         at
JR> com.oreilly.servlet.MultipartRequest.readNextPart(MultipartRequest.java:522)
JR>         at
JR> com.oreilly.servlet.MultipartRequest.readRequest(MultipartRequest.java:610)
JR>         at com.oreilly.servlet.MultipartRequest.<init>(MultipartRequest.java:146)
JR>         at
JR> com.psc.ams.servlets.PSCUploadFilesByExtension.doPost(PSCUploadFilesByExtens
JR> ion.java:480)
JR>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
JR>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
JR>         at
JR> org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java
JR> :446)
JR>         at
JR> org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:216)
JR>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
JR>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
JR>         at
JR> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
JR> FilterChain.java:247)
JR>         at
JR> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
JR> ain.java:193)
JR>         at
JR> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
JR> va:243)
JR>         at
JR> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
JR> 66)
JR>         at
JR> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
JR>         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
JR>         at
JR> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
JR> va:201)
JR>         at
JR> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
JR> 66)
JR>         at
JR> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
JR>         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
JR>         at
JR> org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344)
JR>         at
JR> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164
JR> )
JR>         at
JR> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
JR> 66)
JR>         at
JR> org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
JR> java:170)
JR>         at
JR> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
JR> 64)
JR>         at
JR> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170
JR> )
JR>         at
JR> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
JR> 64)
JR>         at
JR> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
JR>         at
JR> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
JR> 64)
JR>         at
JR> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
JR>         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
JR>         at
JR> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
JR> :163)
JR>         at
JR> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
JR> 66)
JR>         at
JR> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
JR>         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
JR>         at org.apache.ajp.tomcat4.Ajp13Processor.process(Ajp13Processor.java:371)
JR>         at org.apache.ajp.tomcat4.Ajp13Processor.run(Ajp13Processor.java:424)
JR>         at java.lang.Thread.run(Thread.java:484)

JR> Environment:
JR> ------------
JR> - Win2000 Server, patched up to latest levels
JR> - Tomcat 4.0.1 Binary distribution, running as a service
JR> - IIS 5.0, using ISAPI_Redirect.dll dated 12/08/01 (Thank you Henri Gomez!)
JR> - SSL Enabled through IIS
JR> - I have several servers with similar environments.  Some servers have
JR> multiple logical web servers with multiple Tomcat instances.  This
JR> particular server has only one instance of each.  However, the same behavior
JR> is observed on any server/instance with SSL.

JR> Facts:
JR> ------
JR> 1] This only happens on https://, all other forms work fine.
JR> 2] This only happens on files larger than just under 11MB (11,172,378 bytes,
JR> plus or minus a few bytes for filename payload).
JR> 3] The "Assert Failed" error comes from Ajp13.java, Ajp13Packet.java, or
JR> MsgAjp.java.  I am not a Java programmer (yes, another one of those
JR> 'systems' guys), but was able to dig throught the source to find the actual
JR> system.out lines.
JR> 4] 11,172,378 / 1364 = 8191+-, the same size as the ajp packet.  Why 1364
JR> ajp packets?  Anything smaller works fine.

JR> -----Original Message-----
JR> From: Christopher Bare [mailto:christopherbare@yahoo.com]
JR> Sent: Tuesday, March 26, 2002 4:16 PM
JR> To: Tomcat Users List
JR> Subject: Re: How to POST very large data to Servlet? (a question about
JR> ServletRequest.getInputStream)


JR> You should look for information on Multipart requests.
JR> It's a modification of the standard http request that
JR> uses a format similar to that used by the SMTP email
JR> protocol. It's used for uploading files from a browser
JR> to a server.

JR> I think Struts has a handler for multipart requests,
JR> and there is another one available at servlets.com in
JR> the package com.oreilly.serlet.

JR> good luck,

JR> -Chris




JR> --- Zhidong Yu <zh...@ipedo.com> wrote:
>> I want to use HTTP's POST method to send some very
>> large and unknown
>> length data to server. The servlet just receives the
>> data and writes
>> them to disk. The data may be larger than server's
>> buffer size.
>> When the doPost method of my servlet is triggered,
>> has all the content
>> of the HTTP request been transferred to server side?
>>
>>
>> If so, how can I POST very large data by HTTP POST
>> method?
>>
>> If not, the calling to getInputStream() does open
>> the valve to accept
>> data. Am I right?
>>

>> ATTACHMENT part 2 application/x-pkcs7-signature
JR> name=smime.p7s


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>