Closed Bug 1739339 Opened 2 years ago Closed 2 years ago

[D&D] GeckoMain[..]: Couldn't map window as subsurface because its parent is not mapped

Categories

(Core :: Widget: Gtk, defect, P3)

Firefox 95
x86_64
Linux
defect

Tracking

()

RESOLVED FIXED
101 Branch
Tracking Status
firefox101 --- fixed

People

(Reporter: d8v1r3rhk, Assigned: stransky)

References

(Blocks 2 open bugs)

Details

Crash Data

Attachments

(7 files)

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

Steps to reproduce:

I'm running Firefox Developer Edition 95 on Arch Linux.

Actual results:

Non stop logging to journal:
nov 04 10:50:42 desktop GeckoMain[6631]: Couldn't map window 0x7fa816a0cda0 as subsurface because its parent is not mapped.
nov 04 10:50:42 desktop GeckoMain[6631]: Couldn't map window 0x7fa7fb3f37e0 as subsurface because its parent is not mapped.
nov 04 10:50:42 desktop GeckoMain[6631]: Couldn't map window 0x7fa7fb3f3640 as subsurface because its parent is not mapped.
nov 04 10:50:42 desktop GeckoMain[6631]: Couldn't map window 0x7fa81a956da0 as subsurface because its parent is not mapped.
nov 04 10:50:42 desktop GeckoMain[6631]: Couldn't map window 0x7fa8130f0120 as subsurface because its parent is not mapped.
nov 04 10:50:42 desktop GeckoMain[6631]: Couldn't map window 0x7fa815f215c0 as subsurface because its parent is not mapped.
nov 04 10:50:42 desktop GeckoMain[6631]: Couldn't map window 0x7fa816a0eae0 as subsurface because its parent is not mapped.
nov 04 10:50:42 desktop GeckoMain[6631]: Couldn't map window 0x7fa7fb3f3300 as subsurface because its parent is not mapped.
nov 04 10:50:42 desktop GeckoMain[6631]: Couldn't map window 0x7fa7f7ecdfc0 as subsurface because its parent is not mapped.
nov 04 10:50:42 desktop GeckoMain[6631]: Couldn't map window 0x7fa7f7eceb20 as subsurface because its parent is not mapped.
nov 04 10:50:42 desktop GeckoMain[6631]: Couldn't map window 0x7fa7f7ecb8c0 as subsurface because its parent is not mapped.
nov 04 10:50:42 desktop GeckoMain[6631]: Couldn't map window 0x7fa8130ee720 as subsurface because its parent is not mapped.
nov 04 10:50:42 desktop GeckoMain[6631]: Couldn't map window 0x7fa7f9f6c7e0 as subsurface because its parent is not mapped.
nov 04 10:50:42 desktop GeckoMain[6631]: Couldn't map window 0x7fa8003b60a0 as subsurface because its parent is not mapped.
nov 04 10:50:42 desktop GeckoMain[6631]: Couldn't map window 0x7fa816a0cda0 as subsurface because its parent is not mapped.
nov 04 10:50:42 desktop GeckoMain[6631]: Couldn't map window 0x7fa7fb3f37e0 as subsurface because its parent is not mapped.
nov 04 10:50:42 desktop GeckoMain[6631]: Couldn't map window 0x7fa7fb3f3640 as subsurface because its parent is not mapped.
nov 04 10:50:42 desktop GeckoMain[6631]: Couldn't map window 0x7fa81a956da0 as subsurface because its parent is not mapped.
nov 04 10:50:42 desktop GeckoMain[6631]: Couldn't map window 0x7fa8130f0120 as subsurface because its parent is not mapped.
nov 04 10:50:42 desktop GeckoMain[6631]: Couldn't map window 0x7fa815f215c0 as subsurface because its parent is not mapped.
nov 04 10:50:42 desktop GeckoMain[6631]: Couldn't map window 0x7fa816a0eae0 as subsurface because its parent is not mapped.
nov 04 10:50:42 desktop GeckoMain[6631]: Couldn't map window 0x7fa7fb3f3300 as subsurface because its parent is not mapped.
nov 04 10:50:42 desktop GeckoMain[6631]: Couldn't map window 0x7fa7f7ecdfc0 as subsurface because its parent is not mapped.
nov 04 10:50:42 desktop GeckoMain[6631]: Couldn't map window 0x7fa7f7eceb20 as subsurface because its parent is not mapped.
nov 04 10:50:42 desktop GeckoMain[6631]: Couldn't map window 0x7fa7f7ecb8c0 as subsurface because its parent is not mapped.
nov 04 10:50:42 desktop GeckoMain[6631]: Couldn't map window 0x7fa8130ee720 as subsurface because its parent is not mapped.
nov 04 10:50:42 desktop GeckoMain[6631]: Couldn't map window 0x7fa7f9f6c7e0 as subsurface because its parent is not mapped.
nov 04 10:50:42 desktop GeckoMain[6631]: Couldn't map window 0x7fa8003b60a0 as subsurface because its parent is not mapped.
..

Expected results:

No logging/correct mapping(?)

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

Component: Untriaged → Widget: Gtk
Product: Firefox → Core

Thanks for the report! Please open about:support, click on "Copy text to clipboard" and paste it here.

Blocks: wayland
OS: Unspecified → Linux
Hardware: Unspecified → x86_64
Summary: GeckoMain[..]: Couldn't map window as subsurface because its parent is not mapped → KDE Wayland: GeckoMain[..]: Couldn't map window as subsurface because its parent is not mapped

I see this in my logs on Fedora 35 with GNOME desktop as well. Firefox version: 94.0 (64-bit).

I see also a lot of this type of errors in the log:
GeckoMain[247686]: Couldn't map window 0x7f9986975b20 as subsurface because its parent is not mapped.
(Maybe it happens after resuming from suspend, which on GNOME sometimes moves windows to other displays. See also: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2092)

Can you run firefox on terminal and check if you see that during regular use?

Blocks: wayland-popup
No longer blocks: wayland
Flags: needinfo?(francois5537)
Priority: -- → P3

I got many of these Gdk warnings in the terminal during a Firefox Nightly session today, but only during one session:
Gdk-WARNING **: 15:41:23.308: Couldn't map window 0x7fb0b7f1d300 as subsurface because its parent is not mapped.

I have been running Firefox Nightly under KDE Plasma with Wayland for a week, but I haven't seen these warnings under KDE before in the terminal. My OS is Arch Linux.

Maybe related (?): Just a few minutes before the warnings started to appear in the terminal, there were two other warnings (and no other output in between):

Gtk-WARNING **: 15:38:51.405: Attempting to add a widget with type GtkWindow to a container of type GtkWindow, but the widget is already inside a container of type GtkWindow, please remove the widget from its existing container first.

Gtk-CRITICAL **: 15:38:51.996: gtk_bin_remove: assertion 'priv->child == child' failed

I might have seen these two warnings before under Gnome, but I don't know for sure.

Do you mind to run nightly with --g-fatal-warnings argument, it will crash for all warnings. Please submit the crash and attach a crash ID here then.
Thanks.

Here is the report for
Gdk-WARNING **: 09:28:12.090: Couldn't map window 0x7f5c4b46c5c0 as subsurface because its parent is not mapped.:
https://crash-stats.mozilla.org/report/index/8db6036d-23e1-4ce8-bf3b-0d1840211123

Before I got that one, I triggered two other crashes for
Gdk-CRITICAL **: (...): gdk_window_get_width: assertion 'GDK_IS_WINDOW (window)' failed
which were immediately followed by (but obviously not reported)
Gdk-CRITICAL **: (...): gdk_window_get_height: assertion 'GDK_IS_WINDOW (window)' failed.
Here is the first one:
https://crash-stats.mozilla.org/report/index/0d71c371-1be3-4424-8cbc-f51a30211123

I will continue to run with --g-fatal-warnings and hope to catch the Gtk warnings mentioned in comment 7.

Finally the report for
Gtk-WARNING **: 19:15:46.942: Attempting to add a widget with type GtkWindow to a container of type GtkWindow, but the widget is already inside a container of type GtkWindow, please remove the widget from its existing container first.:
https://crash-stats.mozilla.org/report/index/4c3747eb-eb92-4a48-bed8-d07370211124

Thanks, looks like we don't have valid mGdkWindow here.

Assignee: nobody → stransky

Martin, is it helpful if I file separate bug reports for the other two warnings? Those warnings aren't flooding the journal, they only occur rarely as far as I can tell.

I am quite sure that the one with gdk_window_get_width was triggered by clicking on an extension icon, but I don't know exactly what caused the other one. But maybe you (or someone else) can figure that out by looking at the crash report? I can also run with --g-fatal-warnings and pay attention to what I am doing.

Flags: needinfo?(stransky)

No need to file extra bug, I'll do that when I need so.

Is there any particular reproduction steps for the:

Couldn't map window 0x7f5c4b46c5c0 as subsurface because its parent is not mapped

and

Attempting to add a widget with type GtkWindow to a container of type GtkWindow, but the widget is already inside a container of type GtkWindow, please remove the widget from its existing container first.

messages? Seems to be related to D&D operations so did you re-arrange tabs by D&D for instance?

I'd need to reproduce that locally to make sure the fix is correct.
Thanks.

Flags: needinfo?(stransky)
Flags: needinfo?(francois5537) → needinfo?(viktor_jaegerskuepper)

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

Is there any particular reproduction steps for the:

Couldn't map window 0x7f5c4b46c5c0 as subsurface because its parent is not mapped

and

Attempting to add a widget with type GtkWindow to a container of type GtkWindow, but the widget is already inside a container of type GtkWindow, please remove the widget from its existing container first.

messages? Seems to be related to D&D operations so did you re-arrange tabs by D&D for instance?

Unfortunately I don't know how to reproduce these two warnings. I have tried to click and drag and even ALT+TAB in several ways, but they seem to occur randomly. Maybe the tooltips are involved? I sometimes see the subsurface warnings even for Thunderbird (91 ESR) in the journal and I am pretty sure that I don't do any strange things there. I leave the needinfo open and will investigate more.

But I can reproduce the gdk_window_get_width warning by repeated double-clicking on extension icons.

I am now running with --g-fatal-warnings and browser.chrome.toolbar_tips disabled to see if the warnings still occur.

Depends on: 1743095

(Weird) steps to reproduce Gtk-WARNING **: Attempting to add a widget with type GtkWindow to a container of type GtkWindow, but the widget is already inside a container of type GtkWindow, please remove the widget from its existing container first.:

  1. Run Firefox with two tabs
  2. Left-click on a tab and hold the mouse button
  3. Press Ctrl and hold it
  4. Try to drag tab to the left/right -> doesn't work
  5. Release Ctrl and left mouse button (order doesn't matter)
    (The first click on the inactive tab doesn't activate it, but that doesn't matter here.)
  6. Drag the left/right tab to the right/left -> Gtk-WARNING appears
    -> Gtk-CRITICAL **: gtk_bin_remove: assertion 'priv->child == child' failed appears when mouse button is released again

These steps work under KDE, I haven't tried under Gnome. Unfortunately no steps to reproduce the subsurface warning yet, so keeping my needinfo open.

I had a crash two days ago because of the subsurface warning, that happened after I had switched tabs (don't remember if via mouse click or via Ctrl+Tab).

For comparison: I have just started Thunderbird (91) from the command line and immediately got 20 of those warnings when the UI was displayed.

Martin, would it help if I launch Firefox Nightly (or Thunderbird) with some kind of logging? It might still take a few days until I get the warning with Firefox again. :-(

Flags: needinfo?(viktor_jaegerskuepper) → needinfo?(stransky)

(In reply to Viktor Jägersküpper from comment #17)

I had a crash two days ago because of the subsurface warning, that happened after I had switched tabs (don't remember if via mouse click or via Ctrl+Tab).

For comparison: I have just started Thunderbird (91) from the command line and immediately got 20 of those warnings when the UI was displayed.

Martin, would it help if I launch Firefox Nightly (or Thunderbird) with some kind of logging? It might still take a few days until I get the warning with Firefox again. :-(

You, you can run Firefox with MOZ_LOG="Widget:5, WidgetPopup:5" env variable and store the log.
Thanks.

Flags: needinfo?(stransky)

Keeping needinfo to process Comment 16

Flags: needinfo?(stransky)

Here is a log file of a session which contains two of these subsurface warnings. Firefox didn't crash although I was running it with --g-fatal-warnings, so I can't say what I did at that particular moment. I will continue to run with logging to produce a crash, unless you say that you don't need further information.

Side note: Firefox didn't always crash when a warning appeared (despite of running with --g-fatal-warnings) even before I started logging. Maybe that's another bug somewhere?

Attachment #9253234 - Attachment mime type: application/octet-stream → text/plain

The subsurface warning has started to appear again during my current browsing session, but I don't know why or when exactly because Firefox didn't crash. I can trigger it by opening a recently closed tab (either via the toolbar icon menu or via the hamburger menu). The window number is the same every time: Couldn't map window 0x7f5f608100e0 as subsurface because its parent is not mapped.

The warning appeared while the page was loading, and it was shown twice without anything else in between.

Same issue on Firefox 94.0.2 on wayland (NixOS 21.11).

I had an issue with my screen waking up randomly from gnome's lockscreen every 10 minutes or so.
I connected via SSH to this machine and tailed the logs, everytime the screen went on, I saw a few hundreds (thousands?) of those lines:

Dec 07 20:10:27 nixos-xps GeckoMain[5723]: Couldn't map window 0x5555a0084760 as subsurface because its parent is not mapped.
Dec 07 20:10:27 nixos-xps GeckoMain[5723]: Couldn't map window 0x5555a3ebbc10 as subsurface because its parent is not mapped.
Dec 07 20:10:27 nixos-xps GeckoMain[5723]: Couldn't map window 0x5555a0084420 as subsurface because its parent is not mapped.
Dec 07 20:10:27 nixos-xps GeckoMain[5723]: Couldn't map window 0x55559ffb7570 as subsurface because its parent is not mapped.
Dec 07 20:10:27 nixos-xps GeckoMain[5723]: Couldn't map window 0x55559e4ba440 as subsurface because its parent is not mapped.
Dec 07 20:10:27 nixos-xps GeckoMain[5723]: Couldn't map window 0x5555a00840e0 as subsurface because its parent is not mapped.
Dec 07 20:10:27 nixos-xps GeckoMain[5723]: Couldn't map window 0x55559e4baac0 as subsurface because its parent is not mapped.
Dec 07 20:10:27 nixos-xps GeckoMain[5723]: Couldn't map window 0x55559e4ba2a0 as subsurface because its parent is not mapped.
Dec 07 20:10:27 nixos-xps GeckoMain[5723]: Couldn't map window 0x55558f97c2a0 as subsurface because its parent is not mapped.
Dec 07 20:10:27 nixos-xps GeckoMain[5723]: Couldn't map window 0x55558be5b1e0 as subsurface because its parent is not mapped.
Dec 07 20:10:27 nixos-xps GeckoMain[5723]: Couldn't map window 0x5555a0084900 as subsurface because its parent is not mapped.

My firefox is has a few tabs open but nothing is playing or anything.

I'll try adding "--g-fatal-warnings" and post more.

I can reproduce the 'Couldn't map window 0x7ff7e8dd8300 as subsurface because its parent is not mapped.' message with latest KDE when running testsuite:

WAYLAND_DISPLAY=wayland-1 MOZ_ENABLE_WAYLAND=1 ./mach mochitest toolkit/components/extensions/test/mochitest/

Flags: needinfo?(stransky)

I got a crash today because of the subsurface warning. I had tried to visit some sites (which failed because of the unrelated bug 1750188) and then closed the browser via the X button in the upper right corner, which resulted in the crash. The log file is attached.

Crash report:
https://crash-stats.mozilla.org/report/index/2ce7efd9-04dd-48bc-aef1-fa9310220114

Martin, is it still useful if I run Nightly with MOZ_LOG="Widget:5, WidgetPopup:5"? So far I only got two crashes because of the subsurface warning (I forgot to keep the log file for the other one).

Flags: needinfo?(stransky)

To avoid a possible misunderstanding: I was running Nightly with --g-fatal-warnings.

Another crash:
https://crash-stats.mozilla.org/report/index/8a42ea46-3892-40bd-bb8a-e0ea10220115

I had closed a tab so that there was only one open tab in which a page was loading. I pressed Ctrl and got the crash notification. Log file is attached.

Yet another crash:
https://crash-stats.mozilla.org/report/index/17fe2b60-1f71-4176-ada9-ee9ec0220123

I had opened a link from a Google search in a background tab (so that there were two open tabs), and then I got the crash notification while the page in the background tab was loading. Log is attached.

Thanks, I can reproduce that on KDE too, no need for more testing.

Blocks: wayland-kde
Flags: needinfo?(stransky)

I am seeing the Attempting to add a widget with type GtkWindow to a container of type GtkWindow, but the widget is already inside a container of type GtkWindow, please remove the widget from its existing container first. warning when testing bug 1760449: using the firefox snap in a Wayland session under GNOME shell 42, dragging tabs to re-order them doesn't work, and this warning gets printed everytime a tab is selected to initiate a drag.

See Also: → 1760449

(In reply to Olivier Tilloy from comment #30)

I am seeing the Attempting to add a widget with type GtkWindow to a container of type GtkWindow, but the widget is already inside a container of type GtkWindow, please remove the widget from its existing container first. warning when testing bug 1760449: using the firefox snap in a Wayland session under GNOME shell 42, dragging tabs to re-order them doesn't work, and this warning gets printed everytime a tab is selected to initiate a drag.

Olivier, is that with snap only or with Mozilla binaries too?

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

Olivier, is that with snap only or with Mozilla binaries too?

snap only

Cool, I can reproduce that on Ubuntu 22.04 with Mozilla binaries too. Will look at it.

Summary: KDE Wayland: GeckoMain[..]: Couldn't map window as subsurface because its parent is not mapped → [D&D] GeckoMain[..]: Couldn't map window as subsurface because its parent is not mapped

Martin, if that helps, I have bisected mutter and gnome-shell until I identified the revision in mutter that caused the drag and drop regression in the firefox snap, and it is https://gitlab.gnome.org/GNOME/mutter/-/commit/26676a829e74859488154cd8c45de1d0b629f3ca. More specifically the changes to src/core/events.c, apparently (now testing to confirm this).

Confirmed, I rebuilt mutter in Ubuntu 22.04 with the following patch, and the problem in the firefox snap is gone:

--- a/src/core/events.c
+++ b/src/core/events.c
@@ -523,10 +523,6 @@ meta_display_handle_event (MetaDisplay
 #ifdef HAVE_WAYLAND
   if (wayland_compositor && !bypass_wayland)
     {
-      if (window && event->type == CLUTTER_MOTION &&
-          event->any.time != CLUTTER_CURRENT_TIME)
-        meta_window_check_alive_on_event (window, event->any.time);
-
       if (meta_wayland_compositor_handle_event (wayland_compositor, event))
         bypass_clutter = TRUE;
     }

Great. There's also underlying problem in Firefox (the Couldn't map window as subsurface because its parent is not mapped) so I'll look at it.

Blocks: linuxdad
No longer blocks: wayland-kde
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

We use mDragPopup to visualize D&D operation. When previous D&D operation is not finished and new one is started, emulate what internal Gtk routine gtk_drag_remove_icon() does
and remove mDragPopup from the previous D&D context to avoid Gtk confusion.

Depends on D143594

Crash Signature: [@ wl_array_copy | wl_log_set_handler_client]
Pushed by stransky@redhat.com:
https://hg.mozilla.org/integration/autoland/rev/c874e82b0386
[Linux] Log GdkDragContext in D&D logs r=emilio"
https://hg.mozilla.org/integration/autoland/rev/68abcf729df1
[Linux] Remove mDragPopup widget from Gtk D&D context before we reuse it for new D&D operation r=emilio
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 101 Branch
Crash Signature: [@ wl_array_copy | wl_log_set_handler_client] → [@ wl_array_copy | wl_log_set_handler_client] [@ libwayland-client.so.0@0x5cc9] [@ libxul.so@0x314a803 | libwayland-client.so.0@0x9b7b] [@ wl_log]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: