1

I have a Java Spring Boot microservice which uploads documents to a Document Management System (Documentum) by calling a REST interface (Documentum REST). Spring Boot Version is 2.1.5.RELEASE, Spring Cloud Version is Greenwich.RELEASE and the service is deployed using the default embedded Tomcat container that comes with Spring Boot. The REST calls are actioned using the following class: -

org.springframework.web.client.RestTemplate

The service was written originally in Java 1.8 and it worked consistently well. I have recently re-complied the service in Java 11 and deployed to a Java 11 runtime. This required no code changes.

The issue is that since this upgrade, while it still works for small files, the following exception is thrown when the service attempts to upload any file over around 2MB in size: -

Broken pipe (Write failed); nested exception is java.net.SocketException: Broken pipe (Write failed)

My research tells me that this exception occurs when either the client or the server closes the HTTP connection while the other is still attempting to read/write data. I am experimenting with the header values when sending the request, such as increasing the Content-Length, but to no avail yet. Perhaps I should also set the 'Connection' header to 'keep-alive'?

I would be most grateful for any explanations as to why this has suddenly started to happen after a Java version upgrade and any suggestions as to how it may be solved. Many thanks

Jon H
  • 394
  • 3
  • 17
  • There is no general explanation from this ... apart from the one you have already found. We can't tell you why it is happening without seeing the relevant code. And explain why it **started** happening when you upgraded without understanding what is causing this. (There are too many possible explanations to speculate.) – Stephen C Aug 29 '21 at 12:07
  • Thank you @StephenC. I have added some very basic implementation details to my OP. But the post was deliberately simple. I didn't want to flood it with code snippets because the premise is simple: The only change is Java compiler and runtime going from 8 to 11. Everything else: code, env, config, etc is exactly the same. So, I guess at the root of my post I am really asking if anyone knows anything that may have changed between Java 8 and 11 distributions that may lead to what I am seeing. Many thanks – Jon H Aug 29 '21 at 13:04
  • HAve you checked the maximum upload file size allowed from Spring Boot? I know that for upload of files > 1 MB with DFS we had to change Spring file size parameters, but I don't remember if the error was the same – aldago Sep 02 '21 at 16:46

0 Answers0