X11+Xwayland: black window when launched. Possibly caused by Xwayland-on-demand or Firefox race condition when switching between composited/non-composited X11
Categories
(Core :: Widget: Gtk, defect, P2)
Tracking
()
People
(Reporter: guterrien, Unassigned, NeedInfo)
References
(Blocks 1 open bug, Regression)
Details
(Keywords: regression)
Attachments
(9 files)
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:104.0) Gecko/20100101 Firefox/104.0
Steps to reproduce:
Boot.
Enter your password's user.
Simple left-click on the Firefox's menu icon.
Actual results:
A window opens which is totally black and remains black.
Expected results:
A Firefox window should have opened correctly.
Comment 1•2 years ago
|
||
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.
Comment 2•2 years ago
|
||
Original issue was filed downstream, and contains more details: https://bugs.launchpad.net/ubuntu/+source/firefox/+bug/1987976.
This seems to happen only with the firefox snap, and not consistently.
Updated•2 years ago
|
Updated•2 years ago
|
Comment 3•2 years ago
|
||
The reporter wrote in the Launchpad bug report that an apparently reliable workaround is to run firefox with MOZ_ENABLE_WAYLAND=1
.
Comment 4•2 years ago
|
||
Could you please run firefox with MOZ_ENABLE_WAYLAND=1
, browse to about:support
, copy the raw data into the clipboard and share it here?
Updated•2 years ago
|
This morning I forgot to launch Firefox with the command line, I mean I launched Firefox by clicking the icon and it worked! I rebooted to try again but unfortunately it didn't work the second time.
I've just found something which seems strange to me.
I would like to show you screenshots but I cannot attach them...
On this screenshot CaptureBugzilla1788205_1.png of Ubuntu Software, I can see one update available: Firefox!!! How is that possible whereas my system is up to date as you can see on attachment CaptureBugzilla1788205_2.png????
Reporter | ||
Comment 10•2 years ago
|
||
Are there two different ways for updating???
Why the Firefox update does not appear in the update manager window, which is so far, for me, the only way to update my system??
Comment 11•2 years ago
|
||
That's a question for Ubuntu people, looks like the update is for Snap package while your second screenshot is the apt update status
Comment 12•2 years ago
|
||
Can you share the output of the following commands?
apt policy firefox
snap info firefox
Reporter | ||
Comment 13•2 years ago
|
||
nicolas@nicolas-fixe:$ apt policy firefox$ snap info firefox
firefox:
Installé : 1:1snap1-0ubuntu2
Candidat : 1:1snap1-0ubuntu2
Table de version :
*** 1:1snap1-0ubuntu2 500
500 http://fr.archive.ubuntu.com/ubuntu jammy/main amd64 Packages
100 /var/lib/dpkg/status
nicolas@nicolas-fixe:
name: firefox
summary: Mozilla Firefox web browser
publisher: Mozilla✓
store-url: https://snapcraft.io/firefox
contact: https://support.mozilla.org/kb/file-bug-report-or-feature-request-mozilla
license: unset
description: |
Firefox is a powerful, extensible web browser with support for modern web
application technologies.
commands:
- firefox
- firefox.geckodriver
snap-id: 3wdHCAVyZEmYsCMFDE9qt92UV8rC8Wdk
tracking: latest/stable/ubuntu-22.04
refresh-date: aujourd'hui à 09h04, heure des Rocheuses
channels:
latest/stable: 104.0.2-1 2022-09-06 (1810) 185MB -
latest/candidate: 104.0.2-1 2022-09-05 (1810) 185MB -
latest/beta: 105.0b8-1 2022-09-07 (1814) 187MB -
latest/edge: 106.0a1 2022-09-07 (1818) 183MB -
esr/stable: 91.13.0esr-1 2022-09-02 (1791) 161MB -
esr/candidate: 102.2.0esr-2 2022-09-02 (1793) 182MB -
esr/beta: ↑
esr/edge: 102.2.0esr-2 2022-09-02 (1793) 182MB -
installed: 104.0.2-1 (1810) 185MB -
Reporter | ||
Comment 14•2 years ago
|
||
Oh sorry for the strikethrough. I thing it came automatically with the syntax. Let's try this way:
nicolas@nicolas-fixe:$ apt policy firefox
firefox:
Installé : 1:1snap1-0ubuntu2
Candidat : 1:1snap1-0ubuntu2
Table de version :
*** 1:1snap1-0ubuntu2 500
500 http://fr.archive.ubuntu.com/ubuntu jammy/main amd64 Packages
100 /var/lib/dpkg/status
nicolas@nicolas-fixe:$ snap info firefox
name: firefox
summary: Mozilla Firefox web browser
publisher: Mozilla✓
store-url: https://snapcraft.io/firefox
contact: https://support.mozilla.org/kb/file-bug-report-or-feature-request-mozilla
license: unset
description: |
Firefox is a powerful, extensible web browser with support for modern web
application technologies.
commands:
- firefox
- firefox.geckodriver
snap-id: 3wdHCAVyZEmYsCMFDE9qt92UV8rC8Wdk
tracking: latest/stable/ubuntu-22.04
refresh-date: aujourd'hui à 09h04, heure des Rocheuses
channels:
latest/stable: 104.0.2-1 2022-09-06 (1810) 185MB -
latest/candidate: 104.0.2-1 2022-09-05 (1810) 185MB -
latest/beta: 105.0b8-1 2022-09-07 (1814) 187MB -
latest/edge: 106.0a1 2022-09-07 (1818) 183MB -
esr/stable: 91.13.0esr-1 2022-09-02 (1791) 161MB -
esr/candidate: 102.2.0esr-2 2022-09-02 (1793) 182MB -
esr/beta: ↑
esr/edge: 102.2.0esr-2 2022-09-02 (1793) 182MB -
installed: 104.0.2-1 (1810) 185MB -
Comment 15•2 years ago
|
||
Does Ubuntu Software still offer an update for firefox?
Reporter | ||
Comment 17•2 years ago
|
||
I mean: for Firefox.
Comment 18•2 years ago
|
||
The severity field is not set for this bug.
:gerard-majax, could you have a look please?
For more information, please visit auto_nag documentation.
Comment 19•2 years ago
|
||
I have the same black window problem. Can I help?
I can reproduce it with upstream "firefox" unpacked from firefox-104.0.2.tar.bz2 ! (As well as by using the snap)
It seems not to happen if instead of the "firefox" launcher binary, I run "firefox-bin" directly. What's the difference?
It happens the first time I start firefox after logging in. If I quit firefox and start it again, it works. (The window may start black, but it changes after a few seconds. As reported here: https://bugs.launchpad.net/ubuntu/+source/firefox/+bug/1838963 )
My GPU description is "Mesa DRI Intel(R) HD Graphics 2000 (SNB GT1)". (No secondary GPU). I use Ubuntu 22.04.1 (x86_64).
Comment 20•2 years ago
|
||
It seems not to happen if instead of the "firefox" launcher binary, I run "firefox-bin" directly. What's the difference?
Nevermind. I think it can happen with either. It's just a bit random whether it happens or not.
Comment 21•2 years ago
|
||
(In reply to Alan Jenkins from comment #20)
It seems not to happen if instead of the "firefox" launcher binary, I run "firefox-bin" directly. What's the difference?
Nevermind. I think it can happen with either. It's just a bit random whether it happens or not.
Just to clavify, you reproduce with both Snap and tarball downloaded from mozilla.org ?
Can you share about:support
? Can you verify with MOZ_ENABLE_WAYLAND=1 firefox
if the issue disappears?
Comment 22•2 years ago
|
||
Sorry, I can't deal with the randomness. Let's simplify -
$ sudo snap disable firefox
firefox disabled
$ cat ~/.local/share/applications/firefox2.desktop
[Desktop Entry]
Version=1.0
Name=Firefox Web Browser 2
Exec=/bin/bash -c "/home/alan/firefox-104.0.2/firefox/firefox"
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=firefox
Categories=GNOME;GTK;Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;video/webm;application/x-xpinstall;
StartupNotify=true
StartupWMClass=firefox
$
With the above, if I log in and click firefox, I get stuck at the black window. If I quit firefox and try again, I get a temporary black window, and then a working firefox.
If I edit the file and change it to "MOZ_ENABLE_WAYLAND=1 /home/alan/firefox-104.0.2/firefox/firefox", then two things change:
- When I log in and click firefox, firefox works the first time. I don't have to quit it and click it again before I can use firefox.
- When firefox starts, there is no temporary black screen either.
When I was trying to launch firefox from the terminal, I also noticed a difference in debug messages:
$ /bin/bash -c "/home/alan/firefox-104.0.2/firefox/firefox"
ATTENTION: default value of option mesa_glthread overridden by environment.
ATTENTION: default value of option mesa_glthread overridden by environment.
ATTENTION: default value of option mesa_glthread overridden by environment.
[2022-09-19T12:44:36Z ERROR viaduct::backend::ffi] Missing HTTP status
[2022-09-19T12:44:36Z ERROR viaduct::backend::ffi] Missing HTTP status
$
$ /bin/bash -c "MOZ_ENABLE_WAYLAND=1 /home/alan/firefox-104.0.2/firefox/firefox"
Unsupported modifier, resource creation failed.
XXX: resource creation failed
Unsupported modifier, resource creation failed.
XXX: resource creation failed
Unsupported modifier, resource creation failed.
XXX: resource creation failed
[2022-09-19T12:44:43Z ERROR viaduct::backend::ffi] Missing HTTP status
[2022-09-19T12:44:43Z ERROR viaduct::backend::ffi] Missing HTTP status
$
Comment 23•2 years ago
|
||
Comment 24•2 years ago
|
||
Comment 25•2 years ago
|
||
The severity field is not set for this bug.
:gerard-majax, could you have a look please?
For more information, please visit auto_nag documentation.
Comment 26•2 years ago
|
||
(In reply to Alan Jenkins from comment #22)
Sorry, I can't deal with the randomness. Let's simplify -
$ sudo snap disable firefox
firefox disabled
So you dont use Snap anymore from that point
$ cat ~/.local/share/applications/firefox2.desktop
[Desktop Entry]
Version=1.0
Name=Firefox Web Browser 2
Exec=/bin/bash -c "/home/alan/firefox-104.0.2/firefox/firefox"
This is a mozilla-downloaded binary right?
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=firefox
Categories=GNOME;GTK;Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;video/webm;application/x-xpinstall;
StartupNotify=true
StartupWMClass=firefox
$With the above, if I log in and click firefox, I get stuck at the black window. If I quit firefox and try again, I get a temporary black window, and then a working firefox.
That means you repro the black window issue without using Snap, right?
If I edit the file and change it to "MOZ_ENABLE_WAYLAND=1 /home/alan/firefox-104.0.2/firefox/firefox", then two things change:
- When I log in and click firefox, firefox works the first time. I don't have to quit it and click it again before I can use firefox.
- When firefox starts, there is no temporary black screen either.
So does it means that forcing Wayland on mozilla's binary fixes the issue completely?
Updated•2 years ago
|
Comment 27•2 years ago
|
||
Yes to all of the above.
I disabled the Firefox snap. I used this download from mozilla.org, and I still had the black window issue.
And forcing Wayland seems to fix that completely.
Updated•2 years ago
|
Comment 28•2 years ago
|
||
Alan, since you happen to repro without snap, was there a release you got working correctly? Can you try and go back in time and find with mozregression
maybe which patch triggered the issue ? https://mozilla.github.io/mozregression/quickstart.html
Comment 29•2 years ago
•
|
||
Another interesting point would be if setting gfx.x11-egl.force-disabled
(in about:config
) to true
helps with the issue.
Comment 30•2 years ago
|
||
Also, I suppose gfx.webrender.software:true
works around the issue?
Comment 31•2 years ago
|
||
Nice tool. It seemed like nightlies default to Wayland, so I had to test with MOZ_ENABLE_WAYLAND=0.
Bisecting the temporary black window gave:
9:33.09 INFO: Last good revision: d1eb6fe5a1fa5457425c5a33f212516a5eeaa381
9:33.09 INFO: First bad revision: 498e0e6f9b19107c8c17525a3d01a659f89002e8
9:33.09 INFO: Pushlog:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=d1eb6fe5a1fa5457425c5a33f212516a5eeaa381&tochange=498e0e6f9b19107c8c17525a3d01a659f89002e8
With the mozilla-central (nightly?) builds downloaded by mozregression, I could not reproduce the main issue, the black window that remains black. Any suggestions there?
So the following was tested back on my 104.0.2 (originally downloaded from https://download.mozilla.org/?product=firefox-latest-ssl&os=linux64&lang=fr ) :
Another interesting point would be if setting gfx.x11-egl.force-disabled (in about:config) to true helps with the issue.
No.
Also, I suppose gfx.webrender.software:true works around the issue?
No.
Based on the bisection result, I also tried XDG_CURRENT_DESKTOP="". This changed the main issue but did not solve it. The window did not remain black, but it did not show firefox controls either.
Comment 32•2 years ago
|
||
Oh, that's really interesting...so does launching with MOZ_GTK_TITLEBAR_DECORATION=system
also solve the issue?
Comment 33•2 years ago
|
||
(In reply to Robert Mader [:rmader] from comment #32)
Oh, that's really interesting...so does launching with
MOZ_GTK_TITLEBAR_DECORATION=system
also solve the issue?
It does about the same as XDG_CURRENT_DESKTOP="". Instead of remaining black, basically nothing gets drawn. The inside of the window just shows my desktop wallpaper.
(I think XDG_CURRENT_DESKTOP="" shows a titlebar, and MOZ_GTK_TITLEBAR_DECORATION=system doesn't).
Comment 34•2 years ago
|
||
So the fact that even software rendering (gfx.webrender.software:true
) is broken strongly suggest that something with the affected setup is deeply broken - disabling hardware acceleration is usually our last resort for such issues.
Alan, have you tested a few other Xwayland apps and do they all work correctly? And is this on a clean system without weird modifications? :P
Comment 35•2 years ago
|
||
Weird!
I can run xterm. Including immediately after login, which is how I've been reproducing this Firefox issue.
I can change my hacked-up .desktop file to run "WAYLAND_DISPLAY='' libreoffice" instead, and the libreoffice window seems fine.
I can run glxgears, xeyes, and xvidtune ok :-). (Didn't bother trying those immediately after login).
The system should be clean of development or debug hacks. It's a desktop that runs Ubuntu, and I'm not the person who uses it normally. I have some setup scripts (Ansible), that mostly just install the right packages.
You might have noticed from the Launchpad bug, some reddit users reported this on June 30. The poster thought it "just started happening with Firefox 102.0". I don't know if that was the problem. On the system I have, I had it as soon as I updated to Ubuntu 22.04, which was a bit later.
Reddit link: https://old.reddit.com/r/Ubuntu/comments/voat7x/firefox_1020_snap_in_ubuntu_2204_launches_to/
Of course the Launchpad bug is only voted as "affects 4 people", so it doesn't sound like it's universal.
Comment 36•2 years ago
|
||
(In reply to Alan Jenkins from comment #31)
Nice tool. It seemed like nightlies default to Wayland, so I had to test with MOZ_ENABLE_WAYLAND=0.
Bisecting the temporary black window gave:
9:33.09 INFO: Last good revision: d1eb6fe5a1fa5457425c5a33f212516a5eeaa381
9:33.09 INFO: First bad revision: 498e0e6f9b19107c8c17525a3d01a659f89002e8
9:33.09 INFO: Pushlog:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=d1eb6fe5a1fa5457425c5a33f212516a5eeaa381&tochange=498e0e6f9b19107c8c17525a3d01a659f89002e8
Emilio, could it be a regression from bug 1756903 ?
Comment 37•2 years ago
|
||
Seems possible, but I don't know what might be going on in the reporter's machine, since that's a setup that works ~everywhere else?
To double-check, can you confirm that MOZ_GTK_TITLEBAR_DECORATION=system
works, but MOZ_GTK_TITLEBAR_DECORATION=client
doesn't? Also does enabling the system titlebar (from the customize page) prevent it from happening?
Comment 38•2 years ago
|
||
(In reply to Alan Jenkins from comment #35)
Weird!
Indeed :( But thanks for testing!
I can run glxgears, xeyes, and xvidtune ok :-). (Didn't bother trying those immediately after login).
I think these are all apps with server side decorations (SSD). Could you try GDK_BACKEND=x11 cheese
or GDK_BACKEND=x11 gedit
? So we have GTK apps with client side decorations (CSD)?
Comment 39•2 years ago
|
||
To double-check, can you confirm that MOZ_GTK_TITLEBAR_DECORATION=system works
No, I say MOZ_GTK_TITLEBAR_DECORATION=system fails. Just slightly differently. Instead of a black window, only a border (drop shadow?) is drawn. See screenshot. The gnome notification bubble "firefox is ready" is flickering, constantly and quickly.
Comment 40•2 years ago
|
||
-
If I launch gedit with GDK_BACKEND=x11, as the first app after logging in, it appears usable. However the window is incorrectly drawn with a square window border. See screenshot.
If I then launch firefox, using the snap for convenience, firefox is usable.
-
(As before) If I launch firefox using the snap for convenience, as the first app after logging in, it is not usable. Because the entire window is black.
If I then launch gedit with GDK_BACKEND=x11, its window borders are drawn correctly.
Comment 41•2 years ago
|
||
It feels like the problem is to do with socket-activated Xwayland.
I can suppress the issue where firefox remains black, by editing my .desktop file to run "xlsclients" first. I.e.:
Exec=/bin/bash -c "xlsclients; MOZ_ENABLE_WAYLAND=0 /home/alan/firefox-104.0.2/firefox/firefox"
Similarly, the issue with gedit drawing square window border corners is suppressed if I use
Exec=/bin/bash -c "xlsclients; GDK_BACKEND=x11 gedit"
(With less confidence: it seemed that if I ran weston, then "Xwayland :2", then "MOZ_ENABLE_WAYLAND=0 DISPLAY=:2 firefox", then the resulting firefox window was usable).
Comment 42•2 years ago
|
||
Hm, this pretty much sounds like Gnome-Shell bug around Xwayland-on-demand to me - so maybe a better place for that would be https://gitlab.gnome.org/GNOME/mutter/-/issues (or a Ubuntu bug, in case they ship some custom patches).
Comment 43•2 years ago
|
||
Setting Regressed by
field after analyzing regression range found by mozregression in comment #31.
Comment 44•2 years ago
|
||
Something similar happened on Fedora. So I've reported to GNOME.
"Timing/race condition with Xwayland-on-demand breaks firefox & confuses gedit etc"
Link: https://gitlab.gnome.org/GNOME/mutter/-/issues/2472
Updated•2 years ago
|
Comment 45•2 years ago
|
||
(In reply to Robert Mader [:rmader] from comment #42)
Hm, this pretty much sounds like Gnome-Shell bug around Xwayland-on-demand to me - so maybe a better place for that would be https://gitlab.gnome.org/GNOME/mutter/-/issues (or a Ubuntu bug, in case they ship some custom patches).
...
Thanks @sourcejedi! I've so far been unable to reproduce this on four different systems with Fedora 36 or Manjaro,
Hi Robert. I got a new reproducer for Firefox, which doesn't use Xwayland. I ran this on my Fedora 36 system, the system that required a quick hand to reproduce with my .desktop file method.
WARNING for people with photosensitive epilepsy. This will cause full-screen flickering.
- Make sure user X is logged out, or at least not running Firefox.
- Switch to a text console (ctrl + alt + f6) and log in.
startx /usr/bin/fvwm
- Left click on the desktop to open the app menu. Open an xterm.
- Open a second xterm.
- In xterm 1, run
while true; do picom; sleep 0.1; killall picom; done
. The screen will now start flickering. - In xterm 2, run
firefox
Result: Firefox doesn't draw anything inside its window, or is completely black.
Updated•1 year ago
|
Comment 47•1 year ago
|
||
[Firefox 109]
If I am not mistaken:
- it is consistently happening (i.e., completely black right after after boot), and
- when closed for the first time, and reopened, it opens and asks whether to restore previous session or not, and
- I always close Firefox before shutting down, so point 2 should not be applicable
Comment 48•1 year ago
|
||
Robert, do you know what we should be trying to do here? Should it remain an S2 for Firefox?
Comment 49•1 year ago
|
||
Since this was reported for a device running the Crocus Mesa driver in situations where implicit drm modifiers are most likely used (Xwayland, X11 compositor), there's certain chance that it will be fixed by https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21209
Michelet/Alan, any chance you could test that commit?
Comment 50•1 year ago
|
||
Oh wow, I think I just managed to reproduce this on my Iris laptop - in a fresh session with Xwayland on demand. That and comment 45 points to a race condition in the FF code regarding switching between composited and non-composited X11.
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Comment 53•1 year ago
|
||
Redirect a needinfo that is pending on an inactive user to the triage owner.
:stransky, since the bug has high severity and recent activity, could you have a look please?
For more information, please visit auto_nag documentation.
Comment 54•1 year ago
|
||
When Bug 1725245 lands we'll test it and see results on Wayland/XWayland environment.
Comment 55•1 year ago
|
||
In Ubuntu 23.04 kernel 6.1 or 6.2 Firefox does not start at all using his .desktop file, starts with a black screen the 1st time is started from terminal with 'firefox' or 'snap run firefox' and start fine the 2nd time is started from terminal with 'firefox' or 'snap run firefox'
Updated•1 year ago
|
Comment 57•1 year ago
|
||
Upstream issue seems to be on mutter
package and https://salsa.debian.org/gnome-team/mutter/-/blob/8fcc1a017d342e6dadd521dacfa845824a7de490/debian/patches/display-Set-compositor-selection-earlier-on-XWayland.patch seems to be a patch.
Comment 58•1 year ago
|
||
It's shipping as a SRU (23.04) this week. Older releases will come after.
Updated•1 year ago
|
Description
•