title: Unexpected EOF read on the socket during file upload with Spring Boot 2.0
body: <p>I am working on webapp, which is using Spring Boot 2.0 on back-end.
  For some amount of users I am seeing this kind of error:</p>
  
  <pre><code>Failed to 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]
  org.springframework.web.multipart.MultipartException: Failed to 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.
  handleParseFailure(StandardMultipartHttpServletRequest.java:122) at 
  org.springframework.web.multipart.support.
  StandardMultipartHttpServletRequest.
  parseRequest(StandardMultipartHttpServletRequest.java:113) at 
  org.springframework.web.multipart.support.
  StandardMultipartHttpServletRequest.&lt;init 
  (StandardMultipartHttpServletRequest.java:86) at 
  org.springframework.web.multipart.support.
  StandardServletMultipartResolver.
  resolveMultipart(StandardServletMultipartResolver.java:93) at 
  org.springframework.web.servlet.DispatcherServlet.
  checkMultipart(DispatcherServlet.java:1128) at 
  org.springframework.web.servlet.DispatcherServlet.
  doDispatch(DispatcherServlet.java:960) at 
  org.springframework.web.servlet.DispatcherServlet.
  doService(DispatcherServlet.java:925)...
  </code></pre>
  
  <p>Could you help me to understand the root of this problem. I am using this code on server, which looks fine:</p>
  
  <pre><code>@RequestMapping(value = "/upload", method = RequestMethod.POST)
  public ResponseEntity&lt;String&gt; upload(HttpSession session, 
  MultipartHttpServletRequest request) {
  
  MultipartFile multipartFile = request.getFiles("file");
  try (InputStream inputStream = multipartFile.getInputStream()) {
      //logic ...
  }
  
  }
  </code></pre>
  
  <p>As I see from logs, request even don't call server endpoint and fails during sending data from UI side. Looks like some network problem?</p>
  
  <p>Another strange thing is that this kind of error happens like random. Just for ~2-4% jof users requests. Even if user that had problem with upload tries to upload a few more times, often it works fine after that</p>
  
  <p>Thanks for any answers!</p>