jellyfin / jellyfin

The Free Software Media System
https://jellyfin.org
GNU General Public License v2.0
33.77k stars 3.09k forks source link

[Issue]: broken media file breaks "Download missing subtitles" plugin #12077

Open eythian opened 3 months ago

eythian commented 3 months ago

Please describe your bug

I have a media file that is broken somehow (playback also fails.) When the "Download missing subtitles" plugin runs, it checks it with ffmpeg (I'm guessing to see if it has embedded subtitles), this fails, and the process crashes. In the dashboard it shows that the process is stuck at 2%, and it never goes away unless manually cancelled.

Reproduction Steps

  1. Have a broken media file with no subtitle files for it
  2. Run the "Download missing subtitles" scheduled task
  3. See that the task stops processing.

Jellyfin Version

10.9.0

if other:

10.9.4

Environment

- OS: Debian Linux
- Linux Kernel: 6.9.3-zabbly+
- Virtualization: no
- Clients: n/a
- Browser: n/a
- FFmpeg Version: ffmpeg version 6.0.1-Jellyfin
- Playback Method: n/a
- Hardware Acceleration: QSV
- GPU Model: Intel something or other but it's not used here
- Plugins: Open Subtitles
- Reverse Proxy: n/a
- Base URL: /
- Networking: fine
- Storage: plenty

Jellyfin logs

[2024-06-11 15:21:07.258 +02:00] [INF] Remaining downloads: 990
[2024-06-11 15:21:07.396 +02:00] [INF] Saving subtitles to "/mnt/media/jellyfin/metadata/library/b8/b8d66f8b2e4df78a1d2f241a950245dd/The.Thing.1982.1080p.BluRay.x264-[YTS.AG].dut.20.srt"
[2024-06-11 15:21:07.496 +02:00] [INF] Remaining downloads: 989
[2024-06-11 15:21:07.603 +02:00] [INF] Saving subtitles to "/mnt/media/jellyfin/metadata/library/b8/b8d66f8b2e4df78a1d2f241a950245dd/The.Thing.1982.1080p.BluRay.x264-[YTS.AG].eng.21.srt"
[2024-06-11 15:21:07.619 +02:00] [INF] Starting "/usr/lib/jellyfin-ffmpeg/ffprobe" with args "-analyzeduration 200M -probesize 1G -i file:\"/mnt/media/Movies/The Thing (1982) [1080p] [YTS.AG]/The.Thing.1982.1080p.BluRay.x264-[YTS.AG].mp4\" -threads 0 -v warning -print_format json -show_streams -show_chapters -show_format"
[2024-06-11 15:21:07.714 +02:00] [ERR] Error in "Probe Provider"
MediaBrowser.Common.FfmpegException: ffprobe failed - streams and format are both null.
   at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.GetMediaInfoInternal(String inputPath, String primaryPath, MediaProtocol protocol, Boolean extractChapters, String probeSizeArgument, Boolean isAudio, Nullable`1 videoType, CancellationToken cancellationToken)
   at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.GetMediaInfoInternal(String inputPath, String primaryPath, MediaProtocol protocol, Boolean extractChapters, String probeSizeArgument, Boolean isAudio, Nullable`1 videoType, CancellationToken cancellationToken)
   at MediaBrowser.Providers.MediaInfo.FFProbeVideoInfo.ProbeVideo[T](T item, MetadataRefreshOptions options, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.MetadataService`2.RunCustomProvider(ICustomMetadataProvider`1 provider, TItemType item, String logName, MetadataRefreshOptions options, RefreshResult refreshResult, CancellationToken cancellationToken)

FFmpeg logs

No response

Please attach any browser or client logs here

No response

Please attach any screenshots here

No response

Code of Conduct

eythian commented 3 months ago

After moving that problematic file out of the way, I'm no longer certain it was the cause of the issue. Now when I start the process it gets stuck at 1.9% but I get absolutely no logs from it at all - not even anything to indicate it's starting. I think there are tasks within the plugin that aren't logging that should be, and perhaps (totally guessing) a step that should have timeout set that doesn't.

eythian commented 3 months ago

When I killed the task, the log was the following:

[2024-06-11 15:44:11.130 +02:00] [ERR] Error downloading subtitles from "Open Subtitles"
System.Threading.Tasks.TaskCanceledException: The operation was canceled.
 ---> System.Threading.Tasks.TaskCanceledException: The operation was canceled.
 ---> System.IO.IOException: Unable to read data from the transport connection: Operation canceled.
 ---> System.Net.Sockets.SocketException (125): Operation canceled
   --- End of inner exception stack trace ---
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource<System.Int32>.GetResult(Int16 token)
   at System.Net.Security.SslStream.EnsureFullTlsFrameAsync[TIOAdapter](CancellationToken cancellationToken, Int32 estimatedSize)
   at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token)
   at System.Net.Security.SslStream.ReadAsyncInternal[TIOAdapter](Memory`1 buffer, CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token)
   at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.DecompressionHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.<SendCoreAsync>g__Core|5_0(HttpRequestMessage request, Boolean useAsync, CancellationToken cancellationToken)
   at Microsoft.Extensions.Http.Logging.LoggingScopeHttpMessageHandler.<SendCoreAsync>g__Core|5_0(HttpRequestMessage request, Boolean useAsync, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpClient.HandleFailure(Exception e, Boolean telemetryStarted, HttpResponseMessage response, CancellationTokenSource cts, CancellationToken cancellationToken, CancellationTokenSource pendingRequestsCts)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at Jellyfin.Plugin.OpenSubtitles.OpenSubtitlesHandler.OpenSubtitlesRequestHelper.SendRequestAsync(String url, HttpMethod method, Object body, Dictionary`2 headers, CancellationToken cancellationToken)
   at Jellyfin.Plugin.OpenSubtitles.OpenSubtitlesHandler.RequestHandler.SendRequestAsync(String endpoint, HttpMethod method, Object body, Dictionary`2 headers, Int32 attempt, CancellationToken cancellationToken)
   at Jellyfin.Plugin.OpenSubtitles.OpenSubtitlesHandler.OpenSubtitlesApi.SearchSubtitlesAsync(Dictionary`2 options, CancellationToken cancellationToken)
   at Jellyfin.Plugin.OpenSubtitles.OpenSubtitleDownloader.Search(SubtitleSearchRequest request, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Subtitles.SubtitleManager.SearchSubtitles(SubtitleSearchRequest request, CancellationToken cancellationToken)
[2024-06-11 15:44:11.140 +02:00] [INF] "Download missing subtitles" Cancelled after 5 minute(s) and 7 seconds

this hints to me that perhaps there are issues on the Open Subtitles server end (some connections just hang maybe), and the plugin isn't putting proper timeouts in place to handle this happening. Unfortunately I get no logs from it other than this.

Bidley commented 3 months ago

Also having this issue, running 10.9.6