Browser hangs when previewed many video stream
Closed this issue ยท 2 comments
Describe the bug
Browser will hang and nothing will load when there's many long videos in a folder, while several long videos are previewed and closed.
To Reproduce
- Find a folder with several long (long enough so that the video file needs to be streamed) video.
- Play one of them. Make sure the full video is not downloaded (watch the video progress bar and make sure it's not "cached")
- Exit the preview. Select another video.
- Do step 2 again until you can't load anything.
- Observe that:
- You can't load anything in the page - everything will hang in "loading" state
- You can't load anything from the same site in other pages too
- Refresh the problematic page to fix this issue.
Expected behavior
Browser can preview videos properly.
Screenshots
(sorry the screenshot is taken in Chinese and I have to blur media names - you definitely won't want to know what I'm watching)
As shown in the screenshot, all requests simply hangs and refuse to connect after the reproduce procedure.
Server details
I'm running latest pip
copyparty
with HAProxy
, but I think it's irrelevant - see "additional context" below for my understanding of the bug.
Client details
It happens on both Firefox 122 and Safari iOS.
Additional context
I think the problem is that videos are not properly terminated - it's simply paused and hidden. All video elements are still there:
This causes browser to keep stream connection open - thus creating many GET
requests that never finishes.
When a new request is made (to browse new content), the browser refuses to send it to server as it believes that there are already too much connections in transit.
For anyone interested: I've "fixed" the bug by simply disabling the preview. It is done using a path-based ACL in HAProxy:
backend copyparty
http-request return status 200 content-type 'text/javascript' string 'window.baguetteBox = null;' if { path /.cpr/baguettebox.js }
server default xxx.xxx.xxx.xxx check
Nice! thanks for spotting this :> I'll get it fixed by the next version ๐
And I have to say, very creative workaround ๐