Closed wezell closed 8 years ago
I think this may be applied to the SpeedyServletAsset java class as well. We've seen Broken Pipe messages when large files are delivered in frontend pages but the stream is unexpectedly closed by client (e.g., closing the browser) (re: https://github.com/dotCMS/core/issues/7260)
I think the SpeedyServletAsset just calls the BinaryExporterServlet...
Got it.
If the binary servlet is serving a large file repeatedly (a video on the home page, for example) most visitors will leave the page before the file has been fully downloaded. This causes Tomcat to throw a
after some timeout.
We need to make sure in our binary servlet to always close our file handles in a finally block to guarantee that they will be released back to the system.
To reproduce I added a Thread.sleep in the BinaryExporterServlet to simulate a big file over a network. I then hit it with ab, like this:
With each run, I could see the file handles on the OS file grow and never release: