totem-video-thumbnailer fails in OpenBLAS blas_thread_init

Bug #1988100 reported by Aaron
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
openblas (Ubuntu)
New
Undecided
Unassigned
totem (Ubuntu)
New
Undecided
Unassigned

Bug Description

totem-video-thumbnailer appears to be crashing and so no video thumbnails are generated. This is what happens when I run it manually:

$ totem-video-thumbnailer -v sample.mp4 sample.png
TotemVideoThumbnailer-Message: 11:08:44.734: Initialised libraries, about to create video widget
TotemVideoThumbnailer-Message: 11:08:44.739: setting URI file:///home/aaron/tmp/sample.mp4
TotemVideoThumbnailer-Message: 11:08:44.739: Video widget created
TotemVideoThumbnailer-Message: 11:08:44.739: About to open video file

(totem-video-thumbnailer:416380): GStreamer-WARNING **: 11:08:44.806: failed to create thread: Error creating thread: Resource temporarily unavailable

(totem-video-thumbnailer:416380): GStreamer-WARNING **: 11:08:44.808: failed to create thread: Error creating thread: Resource temporarily unavailable
terminate called after throwing an instance of 'std::bad_alloc'
  what(): std::bad_alloc
Aborted

Passing the -l flag causes it to work fine.

Also, in other tests, which I fail to replicate now, I saw this error:
OpenBLAS blas_thread_init: RLIMIT_NPROC 125184 current, 125184 max

As a workaround I have installed ffmpegthumbnailer and $ln -s /usr/share/thumbnailers/ffmpegthumbnailer.thumbnailer ~/.local/share/thumbnailers/ffmpegthumbnailer.thumbnailer

This has things working for me, but does not really address the problem.

ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: totem 42.0-1ubuntu1
ProcVersionSignature: Ubuntu 5.15.0-47.51-generic 5.15.46
Uname: Linux 5.15.0-47-generic x86_64
NonfreeKernelModules: nvidia_modeset nvidia
ApportVersion: 2.20.11-0ubuntu82.1
Architecture: amd64
CasperMD5CheckResult: pass
CurrentDesktop: ubuntu:GNOME
Date: Tue Aug 30 10:53:06 2022
InstallationDate: Installed on 2021-09-24 (339 days ago)
InstallationMedia: Ubuntu 21.04 "Hirsute Hippo" - Release amd64 (20210420)
SourcePackage: totem
UpgradeStatus: Upgraded to jammy on 2022-07-19 (41 days ago)
modified.conffile..etc.default.apport: [modified]
mtime.conffile..etc.default.apport: 2021-09-27T12:02:48.414586

Revision history for this message
Aaron (apelly) wrote :
Aaron (apelly)
description: updated
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

> OpenBLAS blas_thread_init: RLIMIT_NPROC 125184 current, 125184 max

Don't be alarmed by that. Those two limits are correct and normal per https://manpages.ubuntu.com/manpages/jammy/man2/setrlimit.2.html and it does not mean you actually have that many processes/threads right now.

To check for crashes, please:

1. Look in /var/crash for crash files and if found run:
    ubuntu-bug YOURFILE.crash
Then tell us the ID of the newly-created bug.

2. If step 1 failed then look at https://errors.ubuntu.com/user/ID where ID is the content of file /var/lib/whoopsie/whoopsie-id on the machine. Do you find any links to recent problems on that page? If so then please send the links to us.

Revision history for this message
Aaron (apelly) wrote :

> Don't be alarmed by that. Those two limits are correct and normal

Fair enough. I only mentioned it because I noted that the -l flag allowed the process to complete.

Sadly I have nothing in /var/crash. I see a couple of gnome-shell reports on errors.ubuntu.com but they are from back in March this year.

To be honest, I'm not sure how long this has been going on for. It could have been years. I just happened to notice and be in the mood to do something about it today.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

On second thoughts,

> Error creating thread: Resource temporarily unavailable

sounds like it would be related to RLIMIT_NPROC. Although it does not explain why -l works. Perhaps the thumbnailer contains a thread leak that is triggered by the 30 second limit, which -l avoids.

Aaron (apelly)
summary: - Video thumbnails fail to genetate
+ Video thumbnails fail to generate
Revision history for this message
Aaron (apelly) wrote : Re: Video thumbnails fail to generate

If I run it as root it runs for a few seconds and responds "Killed"

But; something suspicious is happening because I just went to check the exact output and I got this:

$ sudo totem-video-thumbnailer -v sample.mp4 sample.png
TotemVideoThumbnailer-Message: 17:38:03.906: Initialised libraries, about to create video widget
TotemVideoThumbnailer-Message: 17:38:03.908: setting URI file:///home/aaron/tmp/sample.mp4
TotemVideoThumbnailer-Message: 17:38:03.908: Video widget created
TotemVideoThumbnailer-Message: 17:38:03.908: About to open video file
OpenBLAS blas_thread_init: pthread_create failed for thread 7 of 16: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 125184 current, 125184 max

So I am a liar now. But this works:

$ sudo totem-video-thumbnailer -vl sample.mp4 sample.png
TotemVideoThumbnailer-Message: 17:40:03.840: Initialised libraries, about to create video widget
TotemVideoThumbnailer-Message: 17:40:03.842: setting URI file:///home/aaron/tmp/sample.mp4
TotemVideoThumbnailer-Message: 17:40:03.842: Video widget created
TotemVideoThumbnailer-Message: 17:40:03.842: About to open video file
TotemVideoThumbnailer-Message: 17:40:03.948: Checking whether file has cover
TotemVideoThumbnailer-Message: 17:40:03.949: Opened video file: 'sample.mp4'
TotemVideoThumbnailer-Message: 17:40:03.949: About to seek to 0.333333
TotemVideoThumbnailer-Message: 17:40:03.978: About to get frame for iter 0
TotemVideoThumbnailer-Message: 17:40:03.985: Frame for iter 0 is interesting
TotemVideoThumbnailer-Message: 17:40:03.988: Saving captured screenshot to sample.png

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Yeah it sounds like too many threads are created to get around the 30 second limit when -l is not used.

affects: totem (Ubuntu) → openblas (Ubuntu)
summary: - Video thumbnails fail to generate
+ totem-video-thumbnailer fails in OpenBLAS blas_thread_init
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

> OpenBLAS blas_thread_init: pthread_create failed for thread 7 of 16: Resource temporarily unavailable

16 threads is not much so that alone isn't the issue. However https://github.com/xianyi/OpenBLAS/issues/1668 mentions that the offending code might have set the stack ulimit to gigabytes in size, which would make the system quickly run out of virtual address space when creating new threads. Although I doubt the offending "LSF" code is something totem uses, your issue does also look like it has run out of address space for new thread stacks.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.