Opening links results in "Firefox is already running, but is not responding"

Bug #1921931 reported by Joe Barnett
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mozilla Firefox
Won't Fix
Medium
firefox (Ubuntu)
Fix Released
High
Olivier Tilloy

Bug Description

Since the latest package release enabling wayland, I often get the "Firefox is already running, but is not responding. To use Firefox, you must first close the existing Firefox process, restart your device, or use a different profile." message when trying to open links from other applications (eg geary, slack) instead of having the link open in the existing firefox window.

ProblemType: Bug
DistroRelease: Ubuntu 21.04
Package: firefox 87.0+build3-0ubuntu2
ProcVersionSignature: Ubuntu 5.10.0-14.15-generic 5.10.11
Uname: Linux 5.10.0-14-generic x86_64
AddonCompatCheckDisabled: False
ApportVersion: 2.20.11-0ubuntu61
Architecture: amd64
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC0: jbarnett 829438 F.... pulseaudio
BuildID: 20210318103112
CasperMD5CheckResult: unknown
Channel: Unavailable
CurrentDesktop: GNOME
Date: Tue Mar 30 09:14:13 2021
Extensions: extensions.sqlite corrupt or missing
ForcedLayersAccel: False
IfupdownConfig:
 # interfaces(5) file used by ifup(8) and ifdown(8)
 auto lo
 iface lo inet loopback
IncompatibleExtensions: Unavailable (corrupt or non-existant compatibility.ini or extensions.sqlite)
InstallationDate: Installed on 2019-08-17 (591 days ago)
InstallationMedia: Ubuntu 19.04 "Disco Dingo" - Alpha amd64 (20190305.1)
IpRoute:
 default via 192.168.4.1 dev wlp2s0 proto dhcp metric 600
 169.254.0.0/16 dev docker0 scope link metric 1000 linkdown
 172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown
 192.168.4.0/22 dev wlp2s0 proto kernel scope link src 192.168.4.89 metric 600
Locales: extensions.sqlite corrupt or missing
MostRecentCrashID: bp-76c5697a-ecec-48ea-b09a-9db310190506
PrefErrors: Unexpected character ',' before close parenthesis @ /usr/lib/firefox/omni.ja:greprefs.js:352
PrefSources:
 /usr/lib/firefox/defaults/pref/all-ubuntu-gnome.js
 prefs.js
Profiles: Profile0 (Default) - LastVersion=87.0/20210318103112
RunningIncompatibleAddons: False
SourcePackage: firefox
SubmittedCrashIDs: bp-76c5697a-ecec-48ea-b09a-9db310190506
Themes: extensions.sqlite corrupt or missing
UpgradeStatus: Upgraded to hirsute on 2021-02-23 (34 days ago)
dmi.bios.date: 07/15/2020
dmi.bios.release: 1.13
dmi.bios.vendor: Dell Inc.
dmi.bios.version: 1.13.0
dmi.board.name: 0N338G
dmi.board.vendor: Dell Inc.
dmi.board.version: A00
dmi.chassis.type: 31
dmi.chassis.vendor: Dell Inc.
dmi.modalias: dmi:bvnDellInc.:bvr1.13.0:bd07/15/2020:br1.13:svnDellInc.:pnXPS159575:pvr:rvnDellInc.:rn0N338G:rvrA00:cvnDellInc.:ct31:cvr:
dmi.product.family: XPS
dmi.product.name: XPS 15 9575
dmi.product.sku: 080D
dmi.sys.vendor: Dell Inc.

Revision history for this message
In , Mcooper-6 (mcooper-6) wrote :

If I run Nightly with the command "./nightly/firefox-bin", and then click a link in an external application, the link opens correctly in the running instance of Firefox.

If I run Nightly with Wayland enabled with the command "env GDK_BACKEND=wayland ./nightly/firefox-bin", then clicking a link in an external application shows me the profile selection window, as if I had just launched Firefox.

I'm running Nightly build 20181120100045.

Revision history for this message
In , Johnp-j (johnp-j) wrote :

Fwiw, in my case (clicking on a link in Thunderbird) it even ran the updater (because there was a staged Nightly update in my running session) and only afterwards complained that the browser is already running.

Revision history for this message
In , 5-greg (5-greg) wrote :

You can run the second firefox command (i.e. your other apps that will launch links in Firefox) with GDK_BACKEND=wayland as well.

But yeah, this should be fixed, Firefox really should try looking for an existing instance via D-Bus first even without explicit GDK_BACKEND. Or at least try D-Bus after not finding anything via X11.

Revision history for this message
In , Stransky (stransky) wrote :

The builds running under Wayland and X11 are separated - it allows you to use X11 firefox for regular work and Wayland version for debug/testing.

Fedora ships firefox-wayland package which provides desktop file and launcher for Firefox on Wayland which can be registered as a default launcher for html links and so on.

I don't think we should enable mixing X11/DBus remote - we had that on Fedora before and it brings a lot of confusions as it depends on which version (X11/Wayland) is recently running.

Revision history for this message
In , Stransky (stransky) wrote :
Revision history for this message
In , Peter Bašista (pbasista) wrote :

(In reply to Martin Stránský [:stransky] from comment #3)
> I don't think we should enable mixing X11/DBus remote
I agree.

> launcher for Firefox on Wayland which can be registered as a default launcher for html links
Yes, a custom launcher with GDK_BACKEND=wayland override can be created in ~/.local/share/applications/ and registered using "xdg-settings set default-web-browser custom-launcher.desktop". It would cause the other desktop applications to open the links using the correct version of Firefox.

However, even after creating such a launcher and registering it, Firefox would _not_ detect that it is in fact the default browser and it would offer the user to set it as the default browser. If the user agrees, Firefox would create a new launcher with a name similar to "userapp-Nightly-8YETTZ.desktop" and register it. That launcher, however, would use the Firefox executable _directly_, i.e. without the GDK_BACKEND=wayland override.

That would result in launching the non-Wayland version of Firefox by other desktop applications by default, which would then cause the behavior mentioned in this issue.

I think that one of the ways to resolve this would be to update the process of setting the default browser, so that the created launcher would contain the GDK_BACKEND=wayland override if the Firefox process that creates it also runs on Wayland.

Revision history for this message
In , Stransky (stransky) wrote :

GDK_BACKEND is no longer needed, use MOZ_ENABLE_WAYLAND instead (Bug 1522780).

Revision history for this message
In , Stransky (stransky) wrote :

*** This bug has been marked as a duplicate of bug 1522780 ***

Revision history for this message
In , Mcooper-6 (mcooper-6) wrote :

I don't think the change of environment variables has affected the problem here. External apps still use the default launcher, even when existing Firefox is running in Wayland, and setting the default to Wayland via `xdg-settings` still causes Firefox to prompt to reset the default to non-Wayland (as described in comment 5).

Revision history for this message
In , Stransky (stransky) wrote :

(In reply to Michael Cooper [:mythmon] from comment #8)
> I don't think the change of environment variables has affected the problem
> here. External apps still use the default launcher, even when existing
> Firefox is running in Wayland, and setting the default to Wayland via
> `xdg-settings` still causes Firefox to prompt to reset the default to
> non-Wayland (as described in comment 5).

Yes, xdg-settings is not read by Firefox, it's Bug 1526243. Firefox uses Gtk2 routines to set/detect default browser which is incorrect as we're running on Gtk3 now.

Revision history for this message
In , Grayshade (grayshade) wrote :

This sounds like an issue I'm seeing. I'm using Gnome Shell / Wayland with the Dash to panel extension to get a "taskbar".

When running Nightly with `MOZ_ENABLE_WAYLAND=1`, the shell detects it as a different app, so it shows the Xwayland Nightly as not running, and the Wayland window is missing its icon.

In addition, I can't pin it to the taskbar, and the Xwayland Nightly can't activate the Wayland one. So it's behaving as if `--no-remote` was passed.

The same thing happens when I update Firefox while it's running (but I don't consider that to be an issue).

Note that my Wayland Nightly believes it's the default browser.

Revision history for this message
In , Grayshade (grayshade) wrote :

I tried changing my .desktop file (the one used for opening links, I think) to `Exec=env MOZ_ENABLE_WAYLAND=1 /opt/firefox-nightly/firefox-bin %u`, but on startup Firefox believes it's not the default browser and creates a new one without the environment variable.

And there seems to be no (easy) way to pin the app. I still think this should block bug 1543600.

Revision history for this message
In , Grayshade (grayshade) wrote :

Update: after setting `MOZ_ENABLE_WAYLAND=1` globally (e.g. in `~/.pam_environment`), opening links works, so when Wayland gets enabled by default, this issue should no longer occur.

My other problem (the shell not recognizing Firefox as an application) is still blocking IMO, but it's tracked in bug 1530052.

Revision history for this message
In , Asif Youssuff (yoasif) wrote :

> after setting MOZ_ENABLE_WAYLAND=1 globally (e.g. in ~/.pam_environment), opening links works

Thank you for this tip - it closes one of the more annoying things about using Firefox on Wayland.

Revision history for this message
In , tomwjennings (tomwjennings) wrote :

> after setting MOZ_ENABLE_WAYLAND=1 globally (e.g. in ~/.pam_environment), opening links works

Thanks after setting this and restarting Firefox it's all working as it should, it also updated the default browser settings and a restart confirms it's been persisted

Revision history for this message
In , Stransky (stransky) wrote :

*** Bug 1589251 has been marked as a duplicate of this bug. ***

Revision history for this message
In , Stransky (stransky) wrote :

You can use MOZ_DBUS_REMOTE to force Firefox to use only DBus as a remote protocol, see:
https://mastransky.wordpress.com/2020/03/16/wayland-x11-how-to-run-firefox-in-mixed-environment/

Revision history for this message
In , P-bugzilla (p-bugzilla) wrote :

I recently switched from Nightly to Stable on my Arch Linux + Gnome on Wayland desktop.

I have both `MOZ_DBUS_REMOTE` and `MOZ_ENABLE_WAYLAND` enabled in my `.pam_environment`, both correctly shows up as enabled in `about:support` in the Environment listing, yet this fails to work still and I get a "Firefox is already running..." message whenever I try to launch any link from the OS. Even if I *start* Firefox by clicking a link from another app, if I click the same link again in the same app I get the same result. I'm using the [package](https://www.archlinux.org/packages/extra/x86_64/firefox/) version of latest stable Firefox (`81.0.1`).

The weirdest thing about this is not only did this work on Nightly, but if I launch Nightly now, let it set itself as default browser, this works perfectly well in Nightly - all links from the OS correctly open in the browser. So the issue seems to be in stable, somehow, but I'm running out of ideas how to troubleshoot this so any help would be greatly appreciated.

PS: I have two profiles, a nightly and a stable one, stable is set as a default profile and Stable Firefox correctly launches with that profile set, while Nightly uses the nightly profile.

Revision history for this message
Joe Barnett (thejoe) wrote :
Revision history for this message
Olivier Tilloy (osomon) wrote :

Thanks for the report Joe. If I understand correctly, you're saying that it looks like a very recent regression, introduced by https://bazaar.launchpad.net/~mozillateam/firefox/firefox.hirsute/revision/1476 ?

If so, could you hand-edit /usr/bin/firefox to comment out the line that exports MOZ_ENABLE_WAYLAND, and after restarting firefox confirm whether the issue is gone?

Changed in firefox (Ubuntu):
status: New → Incomplete
Revision history for this message
Joe Barnett (thejoe) wrote :

Yes, commenting out the MOZ_ENABLE_WAYLAND line appears to fix the issue. With MOZ_ENABLE_WAYLAND=1, initial link requests work, but after a short while start getting the firefox is running but not responding dialog. Without it, link requests work even after a while.

Changed in firefox (Ubuntu):
status: Incomplete → New
Revision history for this message
Olivier Tilloy (osomon) wrote :

This appears to be a known upstream bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1508803

Revision history for this message
Joe Barnett (thejoe) wrote :

Thanks Olivier. That bug report looks related but seems more like it never works, vs/ works for a little while and then stops working? But adding the MOZ_DBUS_REMOTE flag that it mentions seems to fix the issue when running with MOZ_ENABLE_WAYLAND in limited testing so far.

Revision history for this message
In , Joe Barnett (thejoe) wrote :

Not sure if it's quite the same bug, but I've noticed when running with `MOZ_ENABLE_WAYLAND` added to the `/usr/bin/firefox` script in ubuntu that clicking links from other apps works initially after firefox has started, but after some time of a running firefox window being open ends up with a "Firefox is already running, but is not responding. To use Firefox, you must first close the existing Firefox process, restart your device, or use a different profile." message dialog when clicking links from other apps.

Adding `MOZ_DBUS_REMOTE` in addition to `MOZ_ENABLE_WAYLAND` appears to fix this in somewhat limited testing so far.

downstream bug report: https://bugs.launchpad.net/firefox/+bug/1921931

Changed in firefox:
importance: Unknown → Medium
status: Unknown → Confirmed
Revision history for this message
Olivier Tilloy (osomon) wrote :

https://mastransky.wordpress.com/2020/03/16/wayland-x11-how-to-run-firefox-in-mixed-environment/ is useful to understand the problem.

As suggested there, exporting MOZ_DBUS_REMOTE=1 when running in a wayland session works around the problem.

I can observe the problem in a wayland session if I launch e.g. vlc with GDK_BACKEND=x11 and then click a link in the app (e.g. in the about dialog). With MOZ_DBUS_REMOTE set, the problem is gone.

Changed in firefox (Ubuntu):
status: New → Confirmed
importance: Undecided → High
assignee: nobody → Olivier Tilloy (osomon)
Olivier Tilloy (osomon)
Changed in firefox (Ubuntu):
status: Confirmed → In Progress
Revision history for this message
Joe Barnett (thejoe) wrote :

ok that makes sense, I think opening links from slack (electron/x11) was likely the culprit that "poisoned" the running firefox instance

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package firefox - 87.0+build3-0ubuntu4

---------------
firefox (87.0+build3-0ubuntu4) hirsute; urgency=medium

  * Ensure that opening links from XWayland apps still works (LP: #1921931)

 -- Olivier Tilloy <email address hidden> Tue, 13 Apr 2021 15:59:44 +0200

Changed in firefox (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
In , Stransky (stransky) wrote :

Yes, MOZ_DBUS_REMOTE and MOZ_ENABLE_WAYLAND are the correct variables to run Firefox in mixed environment. That will be fixed automatically when all FF builds uses Wayland, but we need to use that variables until that.

Changed in firefox:
status: Confirmed → Won't Fix
Revision history for this message
In , W-jan-k (w-jan-k) wrote :

*** Bug 1878528 has been marked as a duplicate of this bug. ***

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.