Closed Bug 1709254 Opened 4 years ago Closed 2 years ago

Wayland: Crash "Invalid popup parent window" when having 2 monitors and doing a left click on a bookmark folder near screen edge (submenu does not appear) and then a right click

Categories

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

Firefox 88
x86_64
Linux
defect

Tracking

()

RESOLVED FIXED
105 Branch
Tracking Status
firefox-esr91 --- wontfix
firefox-esr102 --- wontfix
firefox96 --- wontfix
firefox97 --- wontfix
firefox98 --- wontfix
firefox103 --- wontfix
firefox104 --- wontfix
firefox105 --- fixed

People

(Reporter: hansoli, Assigned: stransky)

References

(Blocks 2 open bugs, )

Details

(Keywords: crash, reproducible)

Crash Data

Attachments

(7 files, 1 obsolete file)

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

Steps to reproduce:

I'm using Firefox in Fedora 34 gnome.

  1. Run firefox and move a window to left monitor. (I have two monitor on the system)
  2. Mouse over on bookmark folder.
  3. Left click the folder.
  4. Right click the folder.

Actual results:

On second step: Nothing happens.
On fourth step: Firefox quits without any error messages.

Expected results:

On second step: Bookmarks under the folder will be appeared.
On fourth step: Context menu pop up.

In this case, right monitor is a primary screen.
Even if I changed left monitor to primary screen, the issue still exists. (and another issue occurs: context menu won't pop up on the right monitor, too)

When I use firefox on the right monitor after I set right monitor to primary, everything works fine.

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

Can you please create a screencast [1] of the issue? Seems to be Wayland related.
Thanks.

[1] https://help.gnome.org/users/gnome-help/stable/screen-shot-record.html

Flags: needinfo?(hansoli)
Priority: -- → P3

I took a screencast for the issue.

https://hansoli.dev/sharing/4j2kcrigY

and I found out that the context menu doesn't always open well even in the right screen. It opens only when bookmarks submenu is closed.

Flags: needinfo?(hansoli)

Good, Thanks, I understand now. I'm working on a popup redesign right now so I'll look at it after that.

Can you please test latest nightly under Wayland? A new popup handling code landed there.
Thanks.

Latest nightly build still have an issue. I took another screencast in nightly.

https://hansoli.dev/sharing/QpeS0QH2R

So this is primary a multi-monitor issue, right? IIUC when you have only one monitor or move Firefox to the right one the menus work as expected, correct?

Flags: needinfo?(hansoli)

when you have only one monitor or move Firefox to the right one the menus work as expected, correct?

No. This issue can be broken down into two problems.

  1. Bookmarks sub-menu doesn't appear.
  2. Right-clicking closes Firefox.

If I move firefox window to the right, first problem is resolved. However in second problem, the context menu doesn't appear instead of firefox itself shutting down. (comment #3) I just disconnected the left secondary monitor and tested it and had the same problem.

If I run firefox nightly without MOZ_ENABLE_WAYLAND=1 everything works fine.

Flags: needinfo?(hansoli)

The share link in comment #6 is broken. Use this instead: https://hansoli.dev/sharing/LbY7FAlFD

Please re-test with new nightly as it gets another popup fixes.
Thanks.

Flags: needinfo?(hansoli)

I tested but it still has an issue. :'(
This is my testing video: https://hansoli.dev/sharing/3zaVOgdqN

I don't understand the problem exactly, but it seems not occur if the window is not maximized and there is enough space to the right.

Flags: needinfo?(hansoli)

Good. Please run with MOZ_LOG="WidgetPopup:5" env variable and attach the log here. Also please create a screencast of the session so I can pair the log with popups you're opening. Also please try to make the log as small as possible - do the failing scenario only once and cut it off.
Thanks.

Flags: needinfo?(hansoli)

https://hansoli.dev/sharing/XmvW9IN9d

It's done. This compressed file contains a screencast and a log file pair.

Flags: needinfo?(hansoli)

Thanks. I see the issue the popup is not shown although it's configured.
Do I understand correctly that Firefox also crashes / is closed unexpectedly when you select the bookmarks menu? I don't see that in the log.
Thanks.

Flags: needinfo?(hansoli)

Yes, Firefox closes if I right click on bookmarks menu while popup is not shown. That issue is not included in the previous log. I took another one including that.

https://hansoli.dev/sharing/Hk2i0L68h

Flags: needinfo?(hansoli)

Yes, I can reproduce it when primary screen has 100% scale (left one) and secondary screen has 200% scale (right one). Seems to be related to https://bugzilla.mozilla.org/show_bug.cgi?id=1718507 so I'll retest when it lands.

That's also an issue that we don't check parent window state so the crash happens when we try to attach popup to non-visible parent. That's the crash we see here.

Wayland protocol does not allow to create a popup window without parent
and the parent must be visible. Violation of this rule causes Firefox quit
due to Wayland protocol error.

As a fix always check we have valid (mapped) parent wl_surface owned by
parent GtkWidget before we request popup presentation.

Assignee: nobody → stransky

The fix here address only Firefox quit. The invisible popup is a Mutter bug and needs to be fixed there.

We really need to get crash reports for protocol errors (bug 1726923).

See Also: → 1726923
Attachment #9238217 - Attachment is obsolete: true

Assuming bug 1739696 comment 8 is really the same issue then we now (with bug 1726923) get:

xdg_wm_base@30: error 3: Invalid popup parent window

I.e. https://gitlab.gnome.org/GNOME/mutter/-/blob/b596de26800cd0028e0f264ab7619bde61c69f8f/src/wayland/meta-wayland-xdg-shell.c#L1892-1899

IIUC this should only happen if the parent surface already got unmapped. So while the positioning is likely a Mutter bug (https://gitlab.gnome.org/GNOME/mutter/-/issues/1783), the crash looks like a Firefox issue to me.

This might have been fixed in bug 1624384

(In reply to Robert Mader [:rmader] from comment #22)

Assuming bug 1739696 comment 8 is really the same issue then we now (with bug 1726923) get:

xdg_wm_base@30: error 3: Invalid popup parent window

I.e. https://gitlab.gnome.org/GNOME/mutter/-/blob/b596de26800cd0028e0f264ab7619bde61c69f8f/src/wayland/meta-wayland-xdg-shell.c#L1892-1899

IIUC this should only happen if the parent surface already got unmapped. So while the positioning is likely a Mutter bug (https://gitlab.gnome.org/GNOME/mutter/-/issues/1783), the crash looks like a Firefox issue to me.

This is both Firefox and Mutter issue. Firefox expects there's a popup window so we use such popup as a parent for tooltip. But the popup is not opened (due to Mutter bug) so we get protocol failure as we use non-existent popup as parent.

But the root cause is https://gitlab.gnome.org/GNOME/mutter/-/issues/1768 - popup near to screen edgde is not displayed at all.

Could I get a WAYLAND_DEBUG=1 log for when xdg_wm_base@30: error 3: Invalid popup parent window occurs?

Jonas, do you need Firefox log or are you fine with gedit one? It can be reproduced with any application which tries to open a popup near screen edge on multi-monitor system.

Flags: needinfo?(jadahl)

Anyone that reproduces that error I think would be enough. Can't reproduce with gedit here, only the incorrectly placed popup.

Flags: needinfo?(jadahl)

Hope I get it right. Opened gedit and trying to show the popup on the edge of the left monitor (the popup should be in the right monitor if shown).

[2288000.600] wl_pointer@23.button(43185, 751268083, 273, 1)
[2288000.731] wl_pointer@23.frame()
[2288000.985]  -> zwp_text_input_v3@49.set_surrounding_text("", 0, 0)
[2288001.097]  -> zwp_text_input_v3@49.set_text_change_cause(1)
[2288001.141]  -> zwp_text_input_v3@49.commit()
[2288001.309]  -> wl_compositor@4.create_surface(new id wl_surface@56)
[2288004.158]  -> wl_compositor@4.create_surface(new id wl_surface@57)
[2288004.332]  -> wl_shm_pool@3.create_buffer(new id wl_buffer@58, 741376, 32, 32, 128, 0)
[2288004.547]  -> wl_pointer@23.set_cursor(43181, wl_surface@28, 5, 5)
[2288004.668]  -> wl_surface@28.attach(wl_buffer@58, 0, 0)
[2288004.764]  -> wl_surface@28.set_buffer_scale(1)
[2288004.807]  -> wl_surface@28.damage(0, 0, 32, 32)
[2288004.968]  -> wl_surface@28.commit()
[2288005.002]  -> wl_pointer@23.set_cursor(43181, wl_surface@28, 5, 5)
[2288005.122]  -> wl_surface@28.attach(wl_buffer@58, 0, 0)
[2288005.216]  -> wl_surface@28.set_buffer_scale(1)
[2288005.259]  -> wl_surface@28.damage(0, 0, 32, 32)
[2288005.377]  -> wl_surface@28.commit()
[2288007.175]  -> wl_compositor@4.create_surface(new id wl_surface@59)
[2288007.204]  -> wl_surface@59.set_buffer_scale(2)
[2288007.251]  -> wl_surface@59.set_buffer_scale(2)
[2288007.952]  -> xdg_wm_base@30.create_positioner(new id xdg_positioner@60)
[2288007.973]  -> xdg_positioner@60.set_size(193, 290)
[2288007.988]  -> xdg_positioner@60.set_anchor_rect(2443, 730, 1, 1)
[2288008.014]  -> xdg_positioner@60.set_offset(0, 0)
[2288008.028]  -> xdg_positioner@60.set_anchor(8)
[2288008.038]  -> xdg_positioner@60.set_gravity(8)
[2288008.046]  -> xdg_positioner@60.set_constraint_adjustment(63)
[2288008.056]  -> xdg_wm_base@30.get_xdg_surface(new id xdg_surface@61, wl_surface@59)
[2288008.074]  -> xdg_surface@61.get_popup(new id xdg_popup@62, xdg_surface@45, xdg_positioner@60)
[2288008.097]  -> xdg_positioner@60.destroy()
[2288008.104]  -> xdg_popup@62.grab(wl_seat@24, 43185)
[2288008.119]  -> wl_surface@59.commit()
[2288008.195]  -> wl_pointer@23.set_cursor(43181, wl_surface@28, 5, 5)
[2288008.225]  -> wl_surface@28.attach(wl_buffer@58, 0, 0)
[2288008.245]  -> wl_surface@28.set_buffer_scale(1)
[2288008.254]  -> wl_surface@28.damage(0, 0, 32, 32)
[2288008.279]  -> wl_surface@28.commit()
[2288020.555]  -> wl_surface@34.attach(wl_buffer@53, 0, 0)
[2288020.616]  -> wl_surface@34.set_buffer_scale(1)
[2288020.627]  -> wl_surface@34.damage(0, 0, 4, 4)
[2288020.659]  -> wl_surface@34.damage(26, 70, 2477, 1656)
[2288020.710]  -> xdg_toplevel@46.set_min_size(491, 124)
[2288020.742]  -> xdg_toplevel@46.set_max_size(0, 0)
[2288020.759]  -> xdg_surface@45.set_window_geometry(26, 23, 2477, 1734)
[2288020.814]  -> wl_surface@34.frame(new id wl_callback@63)
[2288020.829]  -> wl_surface@34.commit()
[2288021.505] wl_display@1.delete_id(60)
[2288021.565] xdg_popup@62.configure(2536, 731, 193, 290)
[2288021.601] xdg_surface@61.configure(2532)
[2288021.617]  -> xdg_surface@61.ack_configure(2532)
[2288021.628] wl_keyboard@31.leave(43186, wl_surface@34)
[2288021.657] wl_keyboard@31.modifiers(43187, 0, 0, 16, 0)
[2288021.704] wl_keyboard@31.enter(43187, wl_surface@59, array)
[2288021.820]  -> zwp_text_input_v3@49.disable()
[2288021.854]  -> zwp_text_input_v3@49.commit()
[2288026.725] wl_buffer@53.release()
[2288035.946] wl_display@1.delete_id(63)
[2288035.991] wl_callback@63.done(751268120)
[2288049.341]  -> wl_surface@34.attach(wl_buffer@53, 0, 0)
[2288049.393]  -> wl_surface@34.set_buffer_scale(1)
[2288049.408]  -> wl_surface@34.damage(26, 70, 2477, 1656)
[2288049.447]  -> xdg_toplevel@46.set_min_size(491, 124)
[2288049.464]  -> xdg_toplevel@46.set_max_size(0, 0)
[2288049.480]  -> xdg_surface@45.set_window_geometry(26, 23, 2477, 1734)
[2288049.523]  -> wl_surface@34.frame(new id wl_callback@63)
[2288049.539]  -> wl_surface@34.commit()
[2288049.613]  -> wl_shm@5.create_pool(new id wl_shm_pool@60, fd 19, 990560)
[2288049.650]  -> wl_shm_pool@60.create_buffer(new id wl_buffer@64, 0, 410, 604, 1640, 0)
[2288051.980]  -> wl_surface@59.attach(wl_buffer@64, 0, 0)
[2288052.044]  -> wl_surface@59.set_buffer_scale(2)
[2288052.056]  -> wl_surface@59.damage(0, 0, 205, 302)
[2288052.086]  -> xdg_surface@61.set_window_geometry(6, 5, 193, 290)
[2288052.115]  -> wl_compositor@4.create_region(new id wl_region@65)
[2288052.129]  -> wl_region@65.add(6, 5, 193, 290)
[2288052.158]  -> wl_surface@59.set_input_region(wl_region@65)
[2288052.168]  -> wl_region@65.destroy()
[2288052.187]  -> wl_surface@59.frame(new id wl_callback@66)
[2288052.203]  -> wl_surface@59.commit()
[2288052.350] wl_buffer@53.release()
[2288054.184] wl_display@1.delete_id(65)
[2288054.210] wl_buffer@64.release()

The not showing and wrong placement I can reproduce; what I cannot is the error (xdg_wm_base@30: error 3: Invalid popup parent window). What I wanted to do was to check who was doing something wrong.

(In reply to Jonas Ådahl from comment #30)

The not showing and wrong placement I can reproduce; what I cannot is the error (xdg_wm_base@30: error 3: Invalid popup parent window). What I wanted to do was to check who was doing something wrong.

The error sequence is:

  1. Firefox opens popup near to screen edge.
  2. Popup is not visible although Gtk claims it is.
  3. Firefox opens tooltip over popup from 2). It makes it parent of the tooltip which leads to wayland protocol error.
See Also: → 1746812
Status: UNCONFIRMED → NEW
Crash Signature: [@ wl_log ]
Has STR: --- → yes
Ever confirmed: true
Keywords: crash, reproducible
OS: Unspecified → Linux
Hardware: Unspecified → x86_64
Summary: Firefox quits when using bookmark menu → Wayland: Crash "Invalid popup parent window" when having 2 monitors and doing a left click on a bookmark folder near screen edge (submenu does not appear) and then a right click
Attached file wayland_debug.log.bz2

bp-8d8ba9d0-06f4-4de8-b8b4-37a970220129
Pretty reproducible right clicking in submenus of the bookmarks toolbar using Fedora 35 with a Navi 10 Radeon 5700 XT

PS. This occurs with a single monitor. It does not require dual monitors.

It seems this bug was partially fixed in latest Fedora (Fedora 35, mutter 41.4, Firefox 97.0)

  • Bookmarks sub-menu doesn't appear.
  • Right-clicking on bookmarks menu closes Firefox.

The first bug no longer occurs. The second bug doesn't occur, (Firefox doesn't quit) but the context menu was not came out.

With Firefox snap 99.0.1-1 in Ubuntu 22.04 Wayland session right clicking in submenus of the bookmarks toolbar the sub-menu appear but clicking on 'sort by name' sorts a different submenu.

(In reply to corradoventu@gmail.com from comment #35)

With Firefox snap 99.0.1-1 in Ubuntu 22.04 Wayland session right clicking in submenus of the bookmarks toolbar the sub-menu appear but clicking on 'sort by name' sorts a different submenu.

Please test that with latest nightly:
https://fedoraproject.org/wiki/How_to_debug_Firefox_problems?rd=Bug_info_Firefox#Testing_Mozilla_binaries

and if you can reproduce it please file as a new bug.
Thanks.

Flags: needinfo?(corradoventu)

In Ubuntu 22.04 Wayland session firefox-trunk: Installed: 101.0a1hg20220501r615733-0ubuntu0.22.04.1~umd1
right clicking in submenus (2nd or 3rd column) of the bookmarks toolbar nothing happens. The sub-menu appears only with a right click on the 1st (left) column of the bookmarks toolbar.
NO PROBLEM with xorg session
Will try to open a new bug.
Thanks.

Flags: needinfo?(corradoventu)

Martin, is there anything more that needs to happen here?

Flags: needinfo?(stransky)

We're victim of compositor here - we're told that the popup is mapped but it's missing. I think one fox for that may be to check actual wl_surface of parent window when we attach a popup to it.

Blocks: snap-wayland

There are some possible scenarios which involves the missing windows here:

  1. popup is created but it's not shown by Wayland compositor. It's visible from Firefox POV and we do rendering into it, but that rendering is refused by widget code (as we're missing rendering target) so whole Firefox composition is hold. This is a variant of Bug 1777664 for invisible windows. It's because presshell / refresh driver is shared by main Firefox window and popups created by chrome.

  2. popup is closed by widget code (we have to close tooltips for instance) but it's still alive in Firefox rendering queue. Firefox paints something into that window which is not performed and we see the freeze (Bug 1777664).

  3. we try to attach another popup as a child to the invisible one (from step 1). That leads to Wayland protocol error and crashes whole browser.

So we need to a) handle somehow the missing rendering target and don't block rendering for whole Firefox b) check missing popup and does not attach a child popup to it.

See Also: → 1645677
Flags: needinfo?(stransky)
Pushed by stransky@redhat.com: https://hg.mozilla.org/integration/autoland/rev/279d1c18d423 [Wayland] Close popups without visible parent to avoid application crash due to broken popup hierarchy r=emilio
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 105 Branch
QA Whiteboard: [qa-105b-p2]

Is this worth getting uplifted to ESR102 for the benefit of any distros running it with Wayland enabled by default?

Flags: needinfo?(stransky)

ESR102 is not wayland ready and this is rather corner case scenario. It will also need intensive code backport.

Flags: needinfo?(stransky)

Hello! I reproduced both issues with Firefox 105.0a1 (20220802214455) on Ubuntu 22.04.1 with Wayland Window Protocol. The context menu for the bookmark subfolder is not displayed after left-clicking and right-clicking a bookmark subfolder.
Also repeating to left click and right click a bookmark subfolder will eventually cause a crash sometimes. (https://crash-stats.mozilla.org/report/index/e56b7a12-5838-4f84-9ddd-43b5f0220919). The crash is highly intermittent for me.

However, I can still reproduce the context menu problem and also I reproduced the crash on Ubuntu 22.04.1 LTS with Firefox 105.0 (20220915150737) with WAYLAND Window Protocolwhile using MOZ_LAND=ENABLE_WAY1 and export MOZ_ENABLE_WAYLAND=1 after multiple left-clicking and right-clicking on the bookmark subfolder: https://crash-stats.mozilla.org/report/index/532b6433-812e-4ad6-8819-172d30220919. I could only reproduce the crash once.

Please note that after left-clicking and then right-clicking on a bookmark subfolder that is placed on the visible right side of the bookmark toolbar, there will be no hover effect for the other bookmarks placed inside the opened folder and subfolder. Please see the attached screen recording made on Firefox 105.0(20220915150737) that shows the crash and I will attach another video for the hover effect after this comment.

Should we reopen this bug for the crash issue or this will be fixed in bug 1789558?
Also, is there an already filled issue for the context menu not opening problem, or there should we fill one? Thank you!

Flags: needinfo?(stransky)

Can you test latest nightly?
Thanks.

Flags: needinfo?(stransky) → needinfo?(alexandru.trif)

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

Can you test latest nightly?
Thanks.

Sure. I looked over this today and these are my findings on Ubuntu 22.04 with Firefox 107.0a1 (20220926093803):

  • when Firefox is positioned on the left screen: clicking on a bookmark subfolder and then right-clicking will open the context menu on a random location on the right screen (please see the attached video)
  • when Firefox is positioned on the right screen: clicking on a bookmark subfolder and then right-clicking will not display the context menu on either of the screens
  • if the bookmark folder is right-clicked before the contents are displayed the context menu is displayed in the right position
  • I could not reproduce the crash anymore after trying multiple times to click and right-click the bookmark subfolder folder. If more information is needed please let me know. Thank you!
Flags: needinfo?(alexandru.trif)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: