title: "Failed to parse multipart servlet request" when file uploading interrupted
body: <p>I'm using Spring Boot (1.5.7) and ng2-file-upload (1.2.1) for uploading files to the server.</p>
  
  <p>So I have the next trouble, when file uploading starts and interrupts (on closing browser tab for example) Spring Boot logs next error (two times):</p>
  
  <pre class="lang-java prettyprint-override"><code>2018-10-10 14:45:57.054 ERROR 11540 --- [http-nio-8282-exec-6] o.a.c.c.C.[.[.[.[dispatcherServlet]      : line[182] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.web.multipart.MultipartException: Could not parse multipart servlet request; nested exception is java.io.IOException: org.apache.tomcat.util.http.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. Unexpected EOF read on the socket] with root cause
  java.io.EOFException: Unexpected EOF read on the socket
      at org.apache.coyote.http11.InternalNioInputBuffer.fill(InternalNioInputBuffer.java:152) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.coyote.http11.InternalNioInputBuffer$SocketInputBuffer.doRead(InternalNioInputBuffer.java:177) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.coyote.http11.filters.IdentityInputFilter.doRead(IdentityInputFilter.java:110) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.coyote.http11.AbstractInputBuffer.doRead(AbstractInputBuffer.java:362) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.coyote.Request.doRead(Request.java:476) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.connector.InputBuffer.realReadBytes(InputBuffer.java:344) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.tomcat.util.buf.ByteChunk.substract(ByteChunk.java:395) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.connector.InputBuffer.read(InputBuffer.java:369) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.connector.CoyoteInputStream.read(CoyoteInputStream.java:190) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at java.io.FilterInputStream.read(FilterInputStream.java:133) ~[?:1.8.0_161]
      at org.apache.tomcat.util.http.fileupload.util.LimitedInputStream.read(LimitedInputStream.java:132) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.tomcat.util.http.fileupload.MultipartStream$ItemInputStream.makeAvailable(MultipartStream.java:977) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.tomcat.util.http.fileupload.MultipartStream$ItemInputStream.read(MultipartStream.java:881) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at java.io.FilterInputStream.read(FilterInputStream.java:133) ~[?:1.8.0_161]
      at org.apache.tomcat.util.http.fileupload.util.LimitedInputStream.read(LimitedInputStream.java:132) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at java.io.FilterInputStream.read(FilterInputStream.java:107) ~[?:1.8.0_161]
      at org.apache.tomcat.util.http.fileupload.util.Streams.copy(Streams.java:98) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.tomcat.util.http.fileupload.util.Streams.copy(Streams.java:68) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.tomcat.util.http.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:293) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.connector.Request.parseParts(Request.java:2803) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.connector.Request.parseParameters(Request.java:3178) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.connector.Request.getParameter(Request.java:1109) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.connector.RequestFacade.getParameter(RequestFacade.java:380) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:75) ~[spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) ~[spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:106) ~[spring-boot-actuator-1.5.7.RELEASE.jar:1.5.7.RELEASE]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94) [tomcat-embed-core-8.0.46.jar:8.0.46]
  ...
  </code></pre>
  
  <p>When I added @ExceptionHandler to @ControllerAdvice:</p>
  
  <pre class="lang-java prettyprint-override"><code>@ExceptionHandler(MultipartException.class)
  protected ResponseData handleFileUploadingError(Exception e) {
      log.warn("Failed to upload attachment", e);
      return ResponseData.with(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
  }
  </code></pre>
  
  <p>And next property to application.properties:</p>
  
  <pre><code>spring.mvc.throw-exception-if-no-handler-found=true
  </code></pre>
  
  <p>Now when file uploading interrupted @ExceptionHandler logs error as it should (next snippet) but time to time after that <strong>Spring Boot still logs error from dispatcherServlet</strong> (like in first snippet)</p>
  
  <pre class="lang-java prettyprint-override"><code>2018-10-10 14:52:32.655 WARN 14392 --- [http-nio-8282-exec-9] c.c.i.c.a.ExceptionHandlerAdvice         : line[76] - Failed to upload attachment
  org.springframework.web.multipart.MultipartException: Could not parse multipart servlet request; nested exception is java.io.IOException: org.apache.tomcat.util.http.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. Unexpected EOF read on the socket
      at org.springframework.web.multipart.support.StandardMultipartHttpServletRequest.parseRequest(StandardMultipartHttpServletRequest.java:112) ~[spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE]
      at org.springframework.web.multipart.support.StandardMultipartHttpServletRequest.&lt;init&gt;(StandardMultipartHttpServletRequest.java:86) ~[spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE]
      at org.springframework.web.multipart.support.StandardServletMultipartResolver.resolveMultipart(StandardServletMultipartResolver.java:79) ~[spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE]
      at org.springframework.web.servlet.DispatcherServlet.checkMultipart(DispatcherServlet.java:1104) [spring-webmvc-4.3.11.RELEASE.jar:4.3.11.RELEASE]
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:936) [spring-webmvc-4.3.11.RELEASE.jar:4.3.11.RELEASE]
      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901) [spring-webmvc-4.3.11.RELEASE.jar:4.3.11.RELEASE]
      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) [spring-webmvc-4.3.11.RELEASE.jar:4.3.11.RELEASE]
      at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872) [spring-webmvc-4.3.11.RELEASE.jar:4.3.11.RELEASE]
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:648) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) [spring-webmvc-4.3.11.RELEASE.jar:4.3.11.RELEASE]
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat-embed-websocket-8.0.46.jar:8.0.46]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55) [spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:110) [spring-boot-actuator-1.5.7.RELEASE.jar:1.5.7.RELEASE]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:96) [spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
      at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
      at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
      at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
      at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
      at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
      at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
      at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
      at org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter.doFilter(OAuth2AuthenticationProcessingFilter.java:176) [spring-security-oauth2-2.1.1.RELEASE.jar:?]
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
      at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
      at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE]
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
      at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
      at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE]
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
      at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
      at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177) [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
      at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) [spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE]
      at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262) [spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) [spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:108) [spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81) [spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) [spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:106) [spring-boot-actuator-1.5.7.RELEASE.jar:1.5.7.RELEASE]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1132) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1539) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1495) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_161]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_161]
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.0.46.jar:8.0.46]
      at java.lang.Thread.run(Thread.java:748) [?:1.8.0_161]
  Caused by: java.io.IOException: org.apache.tomcat.util.http.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. Unexpected EOF read on the socket
      at org.apache.catalina.connector.Request.parseParts(Request.java:2876) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.connector.Request.parseParameters(Request.java:3178) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.connector.Request.getParameter(Request.java:1109) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.connector.RequestFacade.getParameter(RequestFacade.java:380) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:75) ~[spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE]
      ... 27 more
  Caused by: org.apache.tomcat.util.http.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. Unexpected EOF read on the socket
      at org.apache.tomcat.util.http.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:297) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.connector.Request.parseParts(Request.java:2803) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.connector.Request.parseParameters(Request.java:3178) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.connector.Request.getParameter(Request.java:1109) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.connector.RequestFacade.getParameter(RequestFacade.java:380) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:75) ~[spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE]
      ... 27 more
  Caused by: java.io.EOFException: Unexpected EOF read on the socket
      at org.apache.coyote.http11.InternalNioInputBuffer.fill(InternalNioInputBuffer.java:152) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.coyote.http11.InternalNioInputBuffer$SocketInputBuffer.doRead(InternalNioInputBuffer.java:177) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.coyote.http11.filters.IdentityInputFilter.doRead(IdentityInputFilter.java:110) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.coyote.http11.AbstractInputBuffer.doRead(AbstractInputBuffer.java:362) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.coyote.Request.doRead(Request.java:476) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.connector.InputBuffer.realReadBytes(InputBuffer.java:344) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.tomcat.util.buf.ByteChunk.substract(ByteChunk.java:395) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.connector.InputBuffer.read(InputBuffer.java:369) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.connector.CoyoteInputStream.read(CoyoteInputStream.java:190) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at java.io.FilterInputStream.read(FilterInputStream.java:133) ~[?:1.8.0_161]
      at org.apache.tomcat.util.http.fileupload.util.LimitedInputStream.read(LimitedInputStream.java:132) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.tomcat.util.http.fileupload.MultipartStream$ItemInputStream.makeAvailable(MultipartStream.java:977) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.tomcat.util.http.fileupload.MultipartStream$ItemInputStream.read(MultipartStream.java:881) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at java.io.FilterInputStream.read(FilterInputStream.java:133) ~[?:1.8.0_161]
      at org.apache.tomcat.util.http.fileupload.util.LimitedInputStream.read(LimitedInputStream.java:132) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at java.io.FilterInputStream.read(FilterInputStream.java:107) ~[?:1.8.0_161]
      at org.apache.tomcat.util.http.fileupload.util.Streams.copy(Streams.java:98) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.tomcat.util.http.fileupload.util.Streams.copy(Streams.java:68) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.tomcat.util.http.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:293) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.connector.Request.parseParts(Request.java:2803) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.connector.Request.parseParameters(Request.java:3178) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.connector.Request.getParameter(Request.java:1109) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.apache.catalina.connector.RequestFacade.getParameter(RequestFacade.java:380) ~[tomcat-embed-core-8.0.46.jar:8.0.46]
      at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:75) ~[spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE]
      ... 27 more
  </code></pre>
  
  <p>Here is part of code from frontend app which responding for file uploading:</p>
  
  <pre class="lang-js prettyprint-override"><code>this.uploader.onAfterAddingFile = (fileItem) =&gt; {
              this.setAuthTokenHeader();
              this.uploader.uploadItem(fileItem);
              this.uploadedFiles.push({
                  id: null,
                  originalName: fileItem.file.name,
                  attachmentName: null
              });
              this.changedCallback(this.uploadedFiles);
              this.scrollToFilesUX();
          };
  </code></pre>
  
  <p>I have no idea what can be wrong. Thanks in advance.</p>
  
  <p>PS: Also I noticed, <strong>if @ExceptionHandler method type is void</strong> and it do nothing but logging error <strong>everything works as it should</strong></p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I thought it's doesn't matter, because controller even not called, as I know it happens because file uploads to the server at first (and exception throws on this step) and then controller executes. But here is my controller method (class annotated as @RestController):</p>
  
  <pre class="lang-java prettyprint-override"><code>@PostMapping(value = "/attachments")
      public ResponseData put(@RequestParam(value = "storeFile", required = false) MultipartFile multipartFile,
                              @RequestParam(required = false) List&lt;DocumentType&gt; documentTypes) throws IOException {
          try {
              return ResponseData.with(attachmentService.uploadTempFile(multipartFile, documentTypes));
          } catch (AttachmentValidationException e) {
              return ResponseData.with(e.getTempFileName(), e.getMessages(), HttpStatus.NOT_ACCEPTABLE);
          }
      }
  </code></pre>
  
  <p><strong>UPDATE 2</strong></p>
  
  <p>Here is chaned @ExceptionHandler method. In that case Spring Boot doesn't log any error (that's good). But now, exception logs as WARN two times. If early it was my WARN log + Spring Boot duplicate ERROR log, now it's my WARN log which duplicates (with different time)</p>
  
  <pre class="lang-java prettyprint-override"><code>@ExceptionHandler(value = MultipartException.class)
      public void handleFileUploadingError(HttpServletResponse response, Exception exception) {
          log.warn("Failed to upload attachment", exception);
          try {
              response.sendError(Response.SC_INTERNAL_SERVER_ERROR, exception.getMessage());
          } catch (IOException e) {
              log.error("Failed to send error response", e);
          }
      }
  </code></pre>