Open Bug 1875247 Opened 1 year ago Updated 1 month ago

gmpopenh264 crash

Categories

(Core :: Audio/Video: GMP, defect)

Firefox 122
x86_64
Linux
defect

Tracking

()

People

(Reporter: gonsolo, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: crash)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0

Steps to reproduce:

Open youtube at https://www.youtube.com/watch?v=_1yhGj7DDh4

Actual results:

Crash in plugin gmpopenh264, e.g.:
https://crash-stats.mozilla.org/report/index/8a98f6ef-ac40-4850-9d6a-69bb50240118

Expected results:

Me listening to a beautiful Bireli Lagrene Solo.

The Bugbug bot thinks this bug should belong to the 'Core::Widget: Gtk' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Widget: Gtk
Product: Firefox → Core
Component: Widget: Gtk → Audio/Video: Playback

Thanks for the report! Which Linux distribution and version do you have?
Do you get any result if you paste $ printenv | grep MOZ_GMP_PATH into a terminal and press enter?

Crash Signature: [@ EMPTY: no frame data available; EmptyMinidump ]
Component: Audio/Video: Playback → Audio/Video: GMP
Keywords: crash
OS: Unspecified → Linux
Hardware: Unspecified → x86_64

The bug has a crash signature, thus the bug will be considered confirmed.

Status: UNCONFIRMED → NEW
Ever confirmed: true

(In reply to Darkspirit from comment #2)

Thanks for the report! Which Linux distribution and version do you have?
Do you get any result if you paste $ printenv | grep MOZ_GMP_PATH into a terminal and press enter?

Ubuntu 23.10 with Firefox PPA from https://launchpad.net/~mozillateam (installed because with Firefox snap links in Pdfs didn't work) and proprietary Nvidia driver 545.29.02.

Firefox 122.0.

I am running the apt version of Firefox for quite some time and there was never a problem.

Not every Youtube-Video crashes, most of them work.

(In reply to gonsolo from comment #4)

Also I'm running Pipewire 0.3.79 and Wayland 1.22.

Also, not Ubuntu-provided Nvidia drivers because they didn't work quite as well as Nvidia's.

(In reply to Darkspirit from comment #2)

Do you get any result if you paste $ printenv | grep MOZ_GMP_PATH into a terminal and press enter?

No, it's empty.

(In reply to gonsolo from comment #4)

Not every Youtube-Video crashes, most of them work.

This one crashes: https://www.youtube.com/watch?v=_1yhGj7DDh4
This one works: https://www.youtube.com/watch?v=IkOfKmGWdnU

My first guess would be different video codecs due to different page view frequencies.

I removed Ubuntu's firefox ppa package and installed Mozilla's deb from https://ftp.mozilla.org/pub/firefox/releases/122.0/linux-x86_64/en-US
and it also crashes.

Firefox nightly deb 124.0a1 (2024-01-22) works.

The libgmpopenh264.so in the nightly profile is exactly the same as in the crashing profile.

The severity field is not set for this bug.
:jimm, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(jmathies)
Crash Signature: [@ EMPTY: no frame data available; EmptyMinidump ]
Flags: needinfo?(jmathies)

The severity field is not set for this bug.
:jimm, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(jmathies)

Is there any workaround for this, without having to change the installation method? It crashes on ubuntu 22.04 using the official deb package (https://support.mozilla.org/en-US/kb/install-firefox-linux#w_install-from-your-distribution-package-manager-recommended).

It is quite disruptive to the web browsing experience. For example, every .mp4 video on this page crashes: https://code.visualstudio.com/updates/v1_86
I am finding myself re-opening webpages in Google chrome several times per day.

I was unable to find a workaround. I found, like gonsolo, that the libgmpopenh264.so in the tar download is identical to the one installed via apt.

Installing firefox via the tar resolves this issue.

Severity: -- → S3
Flags: needinfo?(jmathies)

So, I've found that the issue is caused by AppArmor blocking loading libraries from ~/.mozilla, as blocked by security policy. One could install the needed libraries system-wide by requesting gstreamer1.0-plugins-bad, I'll see if that helps.

Yep, restarting with installed gstreamer helps. So, Firefox/gmp plugin fails to run under AppArmor protection to load the plugin, but if the codec is installed in the system it is used instead.

gstreamer1.0-plugins-bad trick has not worked for me on Ubuntu 24.04

Crash repeatedly happens while using Microsoft Teams (ugh).

BTW, I created https://bugzilla.mozilla.org/show_bug.cgi?id=1951405 about "The gmpopenh264 plugin has crashed" message linking to web page that describes itself as not maintained

See Also: → 1951405

I found my own fix that involves using a premade appamor profile (with a few fixes). I wrote about my solution on stack exchange here but I'll outline the gist here as well:

The Problem

For those who are facing this issue with the apt installed version of firefox, I've found a working fix. The issue seems to be a missing /etc/apparmor.d/usr.bin.firefox file, which has some permission definitions needed to avoid this crash, meaning we'll need to create our own that maps onto our /usr/bin/firefox install.
The Files

You can grab a copy of several apparmor profiles here, including one for usr.bin.firefox. We can place it in the /etc/apparmor.d directory.

The Fixes

There are a few things needed to get it working, however. By default, the abstractions/snap_browsers and abstractions/flatpak-snap files are also needed in the abstractions directory of /etc/apparmor.d These files just define some optional functionality for flatpaks and messaging software like Telegram however, so if you don't want to go through the effort you can also delete Lines 39 and 40:

39|   #include <abstractions/flatpak-snap>
40|   #include <abstractions/open-messaging>

Although if this somehow breaks something in the future, don't say I didn't warn ya!

The tunables/confidential file, however, seems a lot more essential. So make sure to grab a copy and stick it in the tunables sub-directory.

Now that's all done, we need to make a few changes to the usr.bin.firefox apparmor profile itself. First is the fact that the Downloads and Desktop directories are listed in Spanish on lines 14 and 15, so make sure to change those to whatever your respective directories may be:

14| @{USER_DIR} =  @{HOME}/Descargas -> Downloads (or whatever you'd like)
15| @{USER_DIR} += @{HOME}/Escritorio -> Desktop  (or whatever you'd like)

Finally, the actual fix you've been waiting for (Coutresy of /u/djao on reddit)! We need to add a new line to address the permissions needed for the gmpopenh264 plugin, which I'd recommend putting in the # per-user firefox configuration block (around line 238):

250| owner @{HOME}/.{firefox,mozilla}/**/gmp-gmpopenh264/*/lib*so m,

And of course, we need to tell apparmor about our new profile:

sudo apparmor_parser /etc/apparmor.d/usr.bin.firefox

You can also add a --replace if you're updating your current profile instead.

Restart firefox (and maybe your machine), and that should do it!

Disclaimers

These apparmor profiles are, ultimately, being downloaded from some random place on the internet. Make sure to scrutinize their content before you actually make use of them in your own system! The files are also several years old, so there is a chance they are not up-to-date with current standards. Your mileage may vary, no warranties, God help us all, etc.

It has happened to me too and I don't use AppArmor. I use the flatpak version of 144.0.2 so containerisation may be the issue. about:crashes says there are no crash reports.

It happened while I was on Teams, which is similar to what many others seem to report.

(Debian Trixie KDE Plasma)

You need to log in before you can comment on or make changes to this bug.