core icon indicating copy to clipboard operation
core copied to clipboard

Ensure the SpeedyAssetServlet closes properly streams and channels

Open jgambarios opened this issue 12 years ago • 4 comments

This issue came from a client loading a video in his home page:

  • Upload a video to any folder using the Site Browser.
  • Use that video on any page, you can use this example code, where the a5b074c2-e0ad-4f89-a0d0-e75bb3e4ad48 is the identifier of the video.
<video width="500" height="500" poster="/dotAsset/4d7daefa-6adb-4b76-896d-c2d9f95b2280.jpg" controls="controls">
<source src="/dotAsset/a5b074c2-e0ad-4f89-a0d0-e75bb3e4ad48.mp4" type="video/mp4" />
</video>
  • In the front end go to the page with the video, start the streaming and while streaming move to another page.

That last action will throw a:

ClientAbortException:  java.net.SocketException: Broken pipe

which makes sense but lead us to this finally block (https://github.com/dotCMS/core/blob/master/src/com/dotmarketing/servlets/SpeedyAssetServlet.java#L436).

The problem is that any error closing an object will avoid the other objects to being close. Here is my proposal fix: https://github.com/dotCMS/support/commit/0af2ec7631c635748d1c542898d637ab9724cf20

jgambarios avatar Nov 25 '14 19:11 jgambarios

After this commit: https://github.com/dotCMS/core/commit/27df7f7195a78c980a066f4352658a164f912d1b#diff-f370a57f4a0c4892c2794d4a059676f9

The code giving problems is not longer present, I tested Jonathan's example and I didn't see the error in the logs.

oarrietadotcms avatar Nov 26 '14 18:11 oarrietadotcms

Fixed, tested on master // H2 // FF

bryanboza avatar Dec 18 '14 20:12 bryanboza

I just merged this to the new master-3.0 which will be 3.0.1

jtesser avatar Dec 22 '14 13:12 jtesser

Fix is working on 12/22 nightly build. H2/Chrome

shaydotcms avatar Dec 22 '14 20:12 shaydotcms