Open Bug 2036213 Opened 4 months ago Updated 3 months ago

Wayland popup manager permanently broken after subsurface mapping failure

Categories

(Core :: Widget: Gtk, defect)

Firefox 150
defect

Tracking

()

UNCONFIRMED

People

(Reporter: dave, Unassigned, NeedInfo)

References

(Blocks 1 open bug)

Details

Attachments

(4 files)

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

Steps to reproduce:

  1. Run Firefox on GNOME/Wayland
  2. Use normally for some time
  3. Attempt to right-click anywhere in Firefox — no context menu appears.

Actual results:

After Firefox has been running for some period of time on GNOME/Wayland, right-click context menus and middle-click (open link in new tab) stop working permanently until Firefox is restarted. Keyboard shortcuts (Ctrl+T, etc.) continue to function normally. The browser is otherwise responsive.

  • Terminal output shows repeated Gdk-WARNING: Couldn't map window as subsurface because its parent is not mapped at the time of failure
  • Affects Firefox's own chrome (bookmarks bar, new tab page) as well as web content — not a content-process issue
  • Keyboard input continues to work throughout
  • Alt+Tab away and back does not restore functionality
  • Confirmed not extension-related: bug persists in safe mode (--safe-mode)
  • widget.gtk.ignore-bogus-leave-notify=1 and widget.wayland.use-move-to-rect=false do not prevent the issue
  • Note for snap users: forcing X11 mode via GDK_BACKEND=x11 in the desktop launcher seems to be silently overridden by the snap's internal GTK setup (about:support continues to show "Window Protocol: wayland"); MOZ_ENABLE_WAYLAND=0 prevents Firefox from starting entirely, apparently due to X display access restrictions in the snap sandbox

Expected results:

Right-click always produces a context menu.

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
Severity: -- → S3

Please attach your about:support page.

Please try latest nightly directly:
https://fedoraproject.org/wiki/How_to_debug_Firefox_problems#Testing_Mozilla_Nightly_binaries

Can you please run on terminal with G_DEBUG=fatal-warnings env variable, for instance as:

G_DEBUG=fatal-warnings firefox

and when it crashes, submit the crash report here?
Thanks.

Flags: needinfo?(dave)
Attached file crash-report.txt

$ G_DEBUG=fatal-warnings firefox
Gtk-Message: 06:52:03.348: Not loading module "atk-bridge": The functionality is provided by GTK natively. Please try to not load it.
MESA: warning: Support for this platform is experimental with Xe KMD, bug reports may be ignored.
[WARN glean_core] Shutdown called before Glean is initialized. Waiting.
[Parent 58290, Main Thread] WARNING: Couldn't map window 0x7d8a892a6120 as subsurface because its parent is not mapped.: 'glib warning', file /build/firefox/parts/firefox/build/toolkit/xre/nsSigHandlers.cpp:201

(firefox_firefox:58290): Gdk-WARNING **: 07:34:49.321: Couldn't map window 0x7d8a892a6120 as subsurface because its parent is not mapped.
ExceptionHandler::GenerateDump attempting to generate:/home/dgross/snap/firefox/common/.mozilla/firefox/5bpo9azw.default/minidumps/231acc85-de26-874f-3f29-531c7f13ab2a.dmp
ExceptionHandler::GenerateDump cloned child 64579
ExceptionHandler::SendContinueSignalToChild sent continue signal to child
ExceptionHandler::WaitForContinueSignal waiting for continue signal...
ExceptionHandler::GenerateDump minidump generation succeeded
[Parent 58290, Main Thread] WARNING: Couldn't map window 0x7d8a74a27460 as subsurface because its parent is not mapped.: 'glib warning', file /build/firefox/parts/firefox/build/toolkit/xre/nsSigHandlers.cpp:201

(firefox_firefox:58290): Gdk-WARNING **: 07:34:49.532: Couldn't map window 0x7d8a74a27460 as subsurface because its parent is not mapped.
Gtk-Message: 07:34:49.670: Not loading module "atk-bridge": The functionality is provided by GTK natively. Please try to not load it.
Exiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.
Trace/breakpoint trap (core dumped)

Flags: needinfo?(dave)
Attached file about:support

(In reply to Martin Stránský [:stransky] (ni? me) from comment #5)

Thanks. Please submit and attach crash ID here:
https://fedoraproject.org/wiki/Debugging_guidelines_for_Mozilla_products#Using_Mozilla_crash_reporter
Thanks.

Crash ID: 231acc85-de26-874f-3f29-531c7f13ab2a

Flags: needinfo?(dave)

Confirmed on Ubuntu 26.04, Firefox 150.0.2 (deb from Mozilla PPA),
kernel 7.0.0-10-generic, GNOME 50/Wayland.

Also occurred on Ubuntu 24.04 with kernel 6.17.0-1017-oem.

Same symptoms: right-click context menus and other popups stop working
after some hours of use. Keyboard shortcuts continue to work.
Restarting Firefox fixes it temporarily.

dmesg shows:
Couldn't map window as subsurface because its parent is not mapped

Consistently happens after suspend/resume cycles.

Note: unlike the reporter, this does not crash with G_DEBUG=fatal-warnings —
the popup manager becomes permanently broken but Firefox continues running.

I don't see such signature at https://crash-stats.mozilla.org/ - can you submit it and then post the link here?
Thanks.

Flags: needinfo?(dave)

https://crash-stats.mozilla.org/report/index/2f01b8f2-4c7d-48d8-879e-787d10260505(In reply to Martin Stránský [:stransky] (ni? me) from comment #8)

I don't see such signature at https://crash-stats.mozilla.org/ - can you submit it and then post the link here?
Thanks.

https://crash-stats.mozilla.org/report/index/2f01b8f2-4c7d-48d8-879e-787d10260505

Flags: needinfo?(dave)

I'm far from convinced the G_DEBUG=fatal-warnings crash is the same, as for me it happens immediately on startup while the bug happens after suspend/resume (usually)

OTOH I just tried nightly (152.0a1) and beta (151.0b9) and both fix the issue (at least right click works in both while it doesn't in stable firefoxes started at the same time, and the bug has reliably affected all instances of firefox at the same time)
I also reproduced the issue on the stable 150.0.2 tarball so it's probably not an environment thing (between package and mozilla build) -- I wouldn't spend too long on this... And I'll just use beta until fedora gets 151 :)

(the crash with G_DEBUG still happens on nightly and is probably worth investigating regardless)

(In reply to Dave Gross from comment #9)

https://crash-stats.mozilla.org/report/index/2f01b8f2-4c7d-48d8-879e-787d10260505(In reply to Martin Stránský [:stransky] (ni? me) from comment #8)

I don't see such signature at https://crash-stats.mozilla.org/ - can you submit it and then post the link here?
Thanks.

https://crash-stats.mozilla.org/report/index/2f01b8f2-4c7d-48d8-879e-787d10260505

Great! Looks like it comes from mapping event while parent is hidden?

Please run on terminal with

MOZ_LOG="Widget:5,WidgetWayland:5,WidgetPopup:5" G_DEBUG=fatal-warnings

env variables and make it crash and attach the log here (no need to attach crash ID).

Attached file mozlog.moz_log

OTOH I just tried nightly (152.0a1) and beta (151.0b9) and both fix the issue (at least right click works in both while it doesn't in stable firefoxes started at the same time, and the bug has reliably affected all instances of firefox at the same time)

grmbl, sorry about the noise, it does still happen on beta at least.. I'm not sure why it didn't happen on all instances at the same time (not being displayed when entering sleep?) but that wasn't it.

(the crash with G_DEBUG still happens on nightly and is probably worth investigating regardless)

Sorry for this as well, I hadn't understood the meaning of G_DEBUG (force a crash on warning), and I have unrelated warnings due to my setup to please ignore me.

... But I just reproduce the problem again without the WARNING: Couldn't map window 0x7d8a892a6120 as subsurface because its parent is not mapped message being displayed (it usually was), so I'm not sure if the problem and log are related, or if it's another thing... I've attached a mozlog with that, but since there's no crash it's not quite clear what's wrong, and I need to get some sleep, so let's hope Dave can get a log as well.
(The gtk_widget_is_visible() = 0 is fishy? I see this as well when suspend doesn't trigger the bug, but I get new is_visible() = 1 afterwards when it works, and it seems stuck at 0 when the bug occurs? Need to stare at this some more, later this week...)

Will look at it.

Flags: needinfo?(stransky)
See Also: → 2039179
Attached file logs from the terminal

New crash report: bp-21a37950-a129-48a6-814d-6577d0260515

Based on Thinker Li's suggestion that this is related to #2039179, I tried running firefox without being connected to an external monitor (using MOZ_LOG="Widget:5,WidgetWayland:5,WidgetPopup:5" G_DEBUG=fatal-warnings) and it ran fine for several days. Immediately upon returning the laptop to the external monitor, it crashed. I've added the tail of the logs before the crash as an attachment above.

Thanks, the bt looks very interesting!

0 	libglib-2.0.so.0 	_g_log_abort 	/build/gnome-46-2404-sdk/parts/glib/src/glib/gmessages.c:434 	inlined
0 	libglib-2.0.so.0 	g_log_writer_default 	/build/gnome-46-2404-sdk/parts/glib/src/glib/gmessages.c:2955 	context
1 	libxul.so 	glib_log_writer_func(GLogLevelFlags, _GLogField const*, unsigned long, void*) 	/build/firefox/parts/firefox/build/toolkit/xre/nsSigHandlers.cpp:224 	cfi
2 	libglib-2.0.so.0 	g_log_structured_array 	/build/gnome-46-2404-sdk/parts/glib/src/glib/gmessages.c:1874 	cfi
3 	libglib-2.0.so.0 	g_log_structured_standard 	/build/gnome-46-2404-sdk/parts/glib/src/glib/gmessages.c:1931 	cfi
4 	libgdk-3.so.0 	should_map_as_subsurface 	/build/gnome-46-2404-sdk/parts/gtk3/src/gdk/wayland/gdkwindow-wayland.c:3228 	cfi
5 	libgdk-3.so.0 	should_inhibit_resize 	/build/gnome-46-2404-sdk/parts/gtk3/src/gdk/wayland/gdkwindow-wayland.c:1209 	inlined
5 	libgdk-3.so.0 	gdk_wayland_window_maybe_configure 	/build/gnome-46-2404-sdk/parts/gtk3/src/gdk/wayland/gdkwindow-wayland.c:1232 	cfi
6 	libgobject-2.0.so.0 	g_closure_invoke 	/build/gnome-46-2404-sdk/parts/glib/src/gobject/gclosure.c:835 	cfi
7 	libgobject-2.0.so.0 	signal_emit_unlocked_R 	/build/gnome-46-2404-sdk/parts/glib/src/gobject/gsignal.c:3902 	cfi
8 	libgobject-2.0.so.0 	signal_emit_valist_unlocked 	/build/gnome-46-2404-sdk/parts/glib/src/gobject/gsignal.c:3534 	cfi
9 	libgobject-2.0.so.0 	g_signal_emit_by_name 	/build/gnome-46-2404-sdk/parts/glib/src/gobject/gsignal.c:3638 	cfi
10 	libgdk-3.so.0 	_gdk_wayland_screen_remove_output 	/build/gnome-46-2404-sdk/parts/gtk3/src/gdk/wayland/gdkscreen-wayland.c:1932 	cfi
11 	libgdk-3.so.0 	gdk_registry_handle_global_remove 	/build/gnome-46-2404-sdk/parts/gtk3/src/gdk/wayland/gdkdisplay-wayland.c:577 	cfi
12 	libffi.so.8 	ffi_call_unix64 	/usr/src/libffi-3.4.6-1build1/src/x86/unix64.S:104 	cfi
13 	libffi.so.8 	ffi_call_int 	/build/libffi-oEu4Vn/libffi-3.4.6/src/x86/ffi64.c:673 	cfi
14 	libffi.so.8 	ffi_call 	/build/libffi-oEu4Vn/libffi-3.4.6/src/x86/ffi64.c:710 	cfi
15 	libwayland-client.so.0 	wl_closure_invoke 	/usr/src/wayland-1.22.0-2.1build1/src/connection.c:1025 	cfi
16 	libwayland-client.so.0 	dispatch_event 	/usr/src/wayland-1.22.0-2.1build1/src/wayland-client.c:1631 	cfi
17 	libwayland-client.so.0 	dispatch_queue 	/usr/src/wayland-1.22.0-2.1build1/src/wayland-client.c:1777 	inlined
17 	libwayland-client.so.0 	wl_display_dispatch_queue_pending 	/usr/src/wayland-1.22.0-2.1build1/src/wayland-client.c:2019 	cfi
18 	libgdk-3.so.0 	_gdk_wayland_display_queue_events 	/build/gnome-46-2404-sdk/parts/gtk3/src/gdk/wayland/gdkeventsource.c:201 	cfi
19 	libgdk-3.so.0 	gdk_display_get_event 	/build/gnome-46-2404-sdk/parts/gtk3/src/gdk/gdkdisplay.c:442 	cfi
20 	libgdk-3.so.0 	gdk_event_source_dispatch 	/build/gnome-46-2404-sdk/parts/gtk3/src/gdk/wayland/gdkeventsource.c:120 	cfi
21 	libglib-2.0.so.0 	g_main_dispatch 	/build/gnome-46-2404-sdk/parts/glib/src/glib/gmain.c:3398 	cfi
22 	libglib-2.0.so.0 	g_main_context_dispatch_unlocked 	/build/gnome-46-2404-sdk/parts/glib/src/glib/gmain.c:4249 	inlined
22 	libglib-2.0.so.0 	g_main_context_iterate_unlocked 	/build/gnome-46-2404-sdk/parts/glib/src/glib/gmain.c:4314 	cfi
23 	libglib-2.0.so.0 	g_main_context_iteration 	/build/gnome-46-2404-sdk/parts/glib/src/glib/gmain.c:4379 	cfi
24 	libxul.so 	nsAppShell::ProcessNextNativeEvent(bool)

Which distro and desktop do you run?
Thanks.

Flags: needinfo?(dave)

I see it's Ubuntu 24 / Gnome from the about:support.

Flags: needinfo?(dave)

Please try latest nightly:
https://fedoraproject.org/wiki/How_to_debug_Firefox_problems#Testing_Mozilla_Nightly_binaries
It should fix the missing popus while you may still see the "subsurface mapping error".
Thanks.

Flags: needinfo?(dave)

The 'Couldn't map window' error is not related here - it comes from Gtk3 monitor-change code so it's Gtk3 internal issue.

Flags: needinfo?(stransky)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: