Tight thumbnailer resource limit sometimes prevents thumbnailing
I recently stumble upon a bug that constantly prevent totem from generating thumbnails. This is similar to the one that is reported in the mailing list: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=967941#53 (comment #53). The eventual workaround is to specify -l
(which means "no limit").
I want to comment that the description of -l
is somewhat misleading: It says "Don't limit the thumbnailing time to 30 seconds
", but if not specified, the program calls totem_resources_monitor_start
, and it actually sets both the CPU time limit and heap size limit (RLIMIT_DATA
; see totem-resources.c
). This can lead to unexpected consequences. For example, on my machines, the memory limit is too tight for some decoders to load a video:
$ yt-dlp "https://www.youtube.com/watch?v=l7GX_XII2K0" -o test.mkv
(...)
$ build/src/totem-video-thumbnailer test.mkv test.png
(totem-video-thumbnailer:696457): GLib-ERROR **: 18:41:03.546: ../../../glib/gmem.c:134: failed to allocate 3110551 bytes
(trapped)
The memory limit can also make gstreamer fail to generate threads. The outcome of which is worse, as the process will get stuck until it timeouts. On the contrary, if the memory limit weren't there, the whole process should complete in 1s.
$ /usr/bin/totem-video-thumbnailer path/to/some-video.mp4 test.png
(totem-video-thumbnailer:698620): GStreamer-WARNING **: 18:50:39.160: failed to create thread: Error creating thread: Resource temporarily unavailable
totem-video-thumbnailer couldn't process file: 'path/to/some-video.mp4'
Reason: Took too much time to process.
p.s. the described time limit is out-of-sync with totem-resources.c
. Should be 15 seconds.