Bug 1261672 - DISPLAY is set to Wayland display so Firefox crashes on start
DISPLAY is set to Wayland display so Firefox crashes on start
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: glib2 (Show other bugs)
23
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Matthias Clasen
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-09-09 19:08 EDT by Christian Stadelmann
Modified: 2015-11-14 06:22 EST (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-11-14 06:22:17 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Backtrace as requested in #3, see https://fedoraproject.org/wiki/Debugging_guidelines_for_Mozilla_products#Application_crash (205.29 KB, text/plain)
2015-09-10 06:33 EDT, Christian Stadelmann
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
GNOME Desktop 754983 None None None Never

  None (edit)
Description Christian Stadelmann 2015-09-09 19:08:52 EDT
Description of problem:
Firefox crashes when opening links from gtk3 applications.

Version-Release number of selected component (if applicable):
gtk3-3.17.8-1.fc23.x86_64
firefox-40.0.3-1.fc23.x86_64

How reproducible:
always. On every click on any link in gnome-terminal, from gnome-abrt, from any gnome/gtk "About" dialog link, etc. From a fresh firefox profile as well as from an older one.

Steps to Reproduce:
1. Open nautilus
2. open the "About" dialog
3. click one of the links

Actual results:
Firefox crashes. I see the firefox/mozilla crash reporter.

Expected results:
Clicking a link should not crash firefox – obviously.

Additional info:
I don't know whether this is specific to wayland. I don't have a non-wayland session on F23 working right now to test.
Comment 1 Olivier Fourdan 2015-09-10 04:25:07 EDT
Yes, I can reproduce that as well - If firefox is not running it will crash, if it's running it won't do anything.

This seems to be specific to Wayland, it works fine on X11.
Comment 2 Martin Stransky 2015-09-10 04:39:11 EDT
Hm, but Firefox itself run fine, doesn't it? I mean if you launch it from terminal or menu. It crashes when it's launched from active Wayland application, right?
Comment 3 Martin Stransky 2015-09-10 04:52:45 EDT
Anyway, can you please attach a backtrace of the crash? See http://fedoraproject.org/wiki/Debugging_guidelines_for_Mozilla_products for details.
Comment 4 Christian Stadelmann 2015-09-10 06:33:38 EDT
Created attachment 1072081 [details]
Backtrace as requested in #3, see https://fedoraproject.org/wiki/Debugging_guidelines_for_Mozilla_products#Application_crash

What I found weird is that running firefox from gnome-terminal with an URL works fine whereas it crashes with the exact same URL (in fact with the exact same argv pointer in execve) when run from a Gtk application. This led to the assumption that the environment (envp pointer in execve) is culprit.

By diff-ing the env (from running `env` and `strace -f -v -s 2000 -e trace=process gedit`) I found out that the environments differ in 2 or 3 variables. Most important: when run from gnome-terminal, you see "DISPLAY=:0", when run from Gtk applications "DISPLAY=wayland-0".

Running
DISPLAY=:0 firefox http://gnome.org
or
firefox http://gnome.org
works fine while
DISPLAY=wayland-0 firefox http://gnome.org
crashes.

Looks like this is a Gtk/GLib issue, am I right? If yes, please reassign there and change the title.
Comment 5 Martin Stransky 2015-09-10 07:31:38 EDT
the DISPLAY variable should not be a wayland display - Firefox is a X11 app and does not expect wayland here. Thanks for the investigation, moving.
Comment 6 Olivier Fourdan 2015-09-11 07:43:26 EDT
I am not entirely sure this is gtk though, but in glib rather.

gtk invokes gtk_show_uri() which will call g_desktop_app_info_launch_uris_with_spawn() from glib and this is the one that sets the DISPLAY variable:

in glib/gio/gdesktopappinfo.c

2717           display = g_app_launch_context_get_display (launch_context,
2718                                                       G_APP_INFO (info),
2719                                                       launched_files);
2720           if (display)
2721             envp = g_environ_setenv (envp, "DISPLAY", display, TRUE);

The problem with this within Wayland is that g_app_launch_context_get_display() will return the GdkWaylandDisplay and not a GdkX11Display, ie "wayland-0" so glib's g_desktop_app_info_launch_uris_with_spawn() set DISPLAY to the wrong value (not gtk).
Comment 7 Olivier Fourdan 2015-10-09 07:16:33 EDT
Patches have been merged upstream
Comment 8 Christian Stadelmann 2015-11-14 06:22:17 EST
Fixed in Fedora 23 release.

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