Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ClientAbortException: java.io.IOException during big file upload

I have a Spring application where user uploads big files (more than 300 mb). In local, it's working perfectly fine. However, when I try to use my application in Live, most of the time it fails (some times it gets succeed though). Here is the log from console. Can anyone help me to how to get rid of the error. I am using JQuery Chunk file upload functionality. Server is Tomcat 6.

17:02:28,395 DEBUG SessionFactoryUtils:793 - Closing Hibernate Session
File Path:/home/borneind/ty/uploads/7397758850/2190167412/1366559675908_06 - Mergel - Mergedelica.wav
17:02:31,036 DEBUG ExceptionHandlerExceptionResolver:132 - Resolving exception from handler [public void com.jmacksoft.common.controller.TranceController.getDocumentFileContent(javax.servlet.http.HttpServletResponse,javax.servlet.http.HttpServletRequest,java.lang.String,java.lang.String,java.lang.String,java.lang.String) throws java.io.IOException]: ClientAbortException:  java.io.IOException
17:02:31,037 DEBUG ResponseStatusExceptionResolver:132 - Resolving exception from handler [public void com.jmacksoft.common.controller.TranceController.getDocumentFileContent(javax.servlet.http.HttpServletResponse,javax.servlet.http.HttpServletRequest,java.lang.String,java.lang.String,java.lang.String,java.lang.String) throws java.io.IOException]: ClientAbortException:  java.io.IOException
17:02:31,037 DEBUG DefaultHandlerExceptionResolver:132 - Resolving exception from handler [public void com.jmacksoft.common.controller.TranceController.getDocumentFileContent(javax.servlet.http.HttpServletResponse,javax.servlet.http.HttpServletRequest,java.lang.String,java.lang.String,java.lang.String,java.lang.String) throws java.io.IOException]: ClientAbortException:  java.io.IOException
17:02:31,038 DEBUG DispatcherServlet:910 - Could not complete request
ClientAbortException:  java.io.IOException
    at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:358)
    at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:434)
    at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:349)
    at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:381)
    at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:370)
    at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:89)
    at org.springframework.util.FileCopyUtils.copy(FileCopyUtils.java:113)
    at com.jmacksoft.common.controller.TranceController.getDocumentFileContent(TranceController.java:603)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:212)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:900)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:827)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
    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.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
    at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:852)
    at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:584)
    at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1508)
    at java.lang.Thread.run(Thread.java:662)
Caused by: java.io.IOException
    at org.apache.coyote.http11.InternalAprOutputBuffer.flushBuffer(InternalAprOutputBuffer.java:692)
    at org.apache.coyote.http11.InternalAprOutputBuffer$SocketOutputBuffer.doWrite(InternalAprOutputBuffer.java:722)
    at org.apache.coyote.http11.filters.IdentityOutputFilter.doWrite(IdentityOutputFilter.java:118)
    at org.apache.coyote.http11.InternalAprOutputBuffer.doWrite(InternalAprOutputBuffer.java:528)
    at org.apache.coyote.Response.doWrite(Response.java:560)
like image 488
real gadha Avatar asked Jun 05 '13 05:06

real gadha


1 Answers

Waking the zombie based on the fact that the page has been viewed over 2000 times.
Too late for the original poster I'm sure, but for future readers here's your solution.

If you're using jquery you need to set a longer timeout value for your async request to complete. This blog entry provides one method of doing this. In your case you're not logging in, but the example should give you what you need. Quoting the post...

function SuccessFunction(data, status) {

          var obj = jQuery.parseJSON(data.d);
          if (obj.Success == “true”) {
              writeConsole(‘logging in’);
              $.ajax({
                  type: “GET”,
                  url: ‘<% Response.Write(url); %>?’ + obj.UserNameAndPassword,
                  dataType: ‘jsonp’,
                  complete: function() {
                      $.mobile.changePage(“#success”, { transition: “fade” });
                  },
                  timeout: 5000 // sets timeout to 5 seconds
              });
          }
          else {
              $(“#popupFail”).popup(“open”, { transition: “fade” });
              writeConsole(‘login failure ‘);
          }
          return;
      }

...I recommend finding a way to centralize this value rather than sprinkling it arbitrarily throughout your scripts. Be careful not to pick a timeout that is too short in constrained environments. Your development experience is almost always better then the experience in the wild.

like image 177
Adam Avatar answered Sep 30 '22 07:09

Adam