jellyfin / jellyfin-web

Web Client for Jellyfin
https://jellyfin.org
GNU General Public License v2.0
2.27k stars 1.2k forks source link

TV series become unwatchable when they have too many episodes #5779

Open maybeanerd opened 1 month ago

maybeanerd commented 1 month ago

Describe The Bug When starting an episode in a series with many episodes (e.g. one piece, 1110 episodes) the playback is stuck in the loading (before opening player) state forever. This behavior does not occur when I remove 800 of the 1110 episodes and try to play the exact same episode, so it seemed to be related to the amount of total episodes. This also happens on all episodes I tried, not only specific ones.

When digging deeper, I found that on server side, no errors are being thrown, but on client side, there is a request to get all episodes (https://jellyfin.cluster.diluz.io/Shows/cfe.../Episodes?IsVirtualUnaired=false&IsMissing=false&UserId=93d..&Fields=Chapters,Trickplay) which is huge. For one piece, it ends up being 2.4MB and takes quite some time to finish.

The client seems to be unhappy about the duration of the request, as it logs Request timed out image

although in the network tab, the request finishes with 200 (but maybe is stopped early by the client? the response is truncated) image

Steps To Reproduce

  1. Add a series with approx. 1000 episodes
  2. Let library scan finish (important! it doesn't happen if the library scan hasn't added all of the episodes yet)
  3. Try to play one of the episodes
  4. It will load forever

Expected Behavior The episode should start playing (even if it takes long, which I would not expect, but tolerate)

Logs jellyfin.log

Screenshots This is what it will look like forever image

System (please complete the following information):

Additional Context none

maybeanerd commented 1 month ago

I'm going to try to adjust some things in the client experimentally to see if that would actually fix the entire issue - will need to first figure out where even to look If in the meantime a maintainer sees this, feel free to drop some extra info and context on this behavior please

maybeanerd commented 1 month ago

first attempts seem to not break any existing behavior, but stop the problematic call from fetching all episodes: https://github.com/jellyfin/jellyfin-web/compare/master...maybeanerd:jellyfin-web:fix/playback-of-series-with-large-set-of-episodes

I have yet to test this with the 1000+ episode setup, though. Will do so soon™️ to ensure that this actually fixes the cause of the loading issue

maybeanerd commented 1 month ago

Tested the solution, works! It fixes the issue for 1110 episodes. I'll open it as a PR, where I would hope someone who knows more about the system itself can check if this would break other existing behavior. I did try around everything I could think of and nothing seemed broken