Open Bug 1774062 Opened 2 years ago Updated 5 months ago

Ctrl+S and Ctrl+O shortcut-keys trigger too many XDG portal window when running on Xwayland, leading to resources exhaustion

Categories

(Firefox Build System :: Third Party Packaging, defect, P2)

Unspecified
Linux
defect

Tracking

(Not tracked)

People

(Reporter: earl.potters, Unassigned, NeedInfo)

References

(Blocks 4 open bugs)

Details

Attachments

(3 files)

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

Steps to reproduce:

System: Linux 5.15.0-37-generic #39-Ubuntu 22.04 GNU/Linux
Firefox version: 101.0.1

Spamming CTRL-S on Firfox current window

Actual results:

Firefox freezes current window

Expected results:

Not Freeze

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

We indeed trigger too many XDG portal file save dialog, I am unsure whether this is an issue on our side or elsewhere.

Do you repro that on a nightly from edge channel on snap ? It seems nightly does not exhibit this behavior.

Flags: needinfo?(earl.potters)

STRs are a bit worse for me:

  • Open a webpage
  • CTRL+S, then Escape
  • CTRL+S again, maybe twice quickly?

Expected:
One XDG portal window open

Actual:
The shadow around the XDG portal window increases to black, advocating we have many opened.

It's mostly 100% reliable. No repro on Nightly, or on MOZ_ENABLE_WAYLAND=1 firefox so it seems to be due to XWayland

Summary: Ctrl+S shortcut-key causes Ubuntu 22.04 to freeze → Ctrl+S shortcut-key triggers too many XDG portal window when running on Xwayland leading to resources exhaustion

I have been able to fix my issue by changing WAYLAND to XORG display server.

I don't know if Firefox has current issues with Wayland

Flags: needinfo?(earl.potters)
Duplicate of this bug: 1792407
Duplicate of this bug: 1799902
Duplicate of this bug: 1802155
Severity: -- → S3
Component: Widget: Gtk → Third Party Packaging
Priority: -- → P2
Product: Core → Firefox Build System

Nightly and forcing DISABLE_WAYLAND=1 MOZ_ENABLE_WAYLAND=0 snap run firefox I can't reproduce.

Reproduced and logging on https://searchfox.org/mozilla-central/rev/5a49163b7012ded5fa1c4da5aa4f8d3f7c85a5e7/widget/gtk/nsFilePicker.cpp#349 shows a are hitting this code path each time a new portal is spawn, so whatever is happening seems to be triggered by us :(

And logging shows spam of OnKeyPressEvent as well as key_press_event_cb: https://searchfox.org/mozilla-central/rev/5a49163b7012ded5fa1c4da5aa4f8d3f7c85a5e7/widget/gtk/nsWindow.cpp#8227

With GTK_DEBUG=all I get something?

13:57:51.141 -> keycode=37 modifiers=0x0000 keyval=65507 group=0 level=0 consumed_modifiers=0x6002
13:57:51.392 -> keycode=39 modifiers=0x0004 keyval=115 group=0 level=0 consumed_modifiers=0x6083
13:57:51.662 -> keycode=39 modifiers=0x0004 keyval=115 group=0 level=0 consumed_modifiers=0x6083
[...]
13:57:56.539 -> keycode=37 modifiers=0x0000 keyval=65507 group=0 level=0 consumed_modifiers=0x6002
13:57:56.999 -> keycode=39 modifiers=0x0004 keyval=115 group=0 level=0 consumed_modifiers=0x6083
13:57:57.164 -> keycode=39 modifiers=0x0004 keyval=115 group=0 level=0 consumed_modifiers=0x6083
13:57:57.242 -> keycode=39 modifiers=0x0004 keyval=115 group=0 level=0 consumed_modifiers=0x6083
13:57:57.768 -> keycode=39 modifiers=0x0004 keyval=115 group=0 level=0 consumed_modifiers=0x6083
13:57:57.898 -> keycode=39 modifiers=0x0004 keyval=115 group=0 level=0 consumed_modifiers=0x6083
13:57:58.098 -> keycode=39 modifiers=0x0004 keyval=115 group=0 level=0 consumed_modifiers=0x6083
13:57:58.098 -> keycode=39 modifiers=0x0004 keyval=115 group=0 level=0 consumed_modifiers=0x6083
13:57:58.099 -> keycode=39 modifiers=0x0004 keyval=115 group=0 level=0 consumed_modifiers=0x6083
13:57:58.203 -> keycode=39 modifiers=0x0004 keyval=115 group=0 level=0 consumed_modifiers=0x6083
13:57:58.349 -> keycode=39 modifiers=0x0004 keyval=115 group=0 level=0 consumed_modifiers=0x6083
13:57:58.353 -> keycode=39 modifiers=0x0004 keyval=115 group=0 level=0 consumed_modifiers=0x6083
13:57:58.353 -> keycode=39 modifiers=0x0004 keyval=115 group=0 level=0 consumed_modifiers=0x6083
13:57:58.354 -> keycode=39 modifiers=0x0004 keyval=115 group=0 level=0 consumed_modifiers=0x6083
13:57:58.354 -> keycode=39 modifiers=0x0004 keyval=115 group=0 level=0 consumed_modifiers=0x6083
13:57:58.638 -> keycode=39 modifiers=0x0004 keyval=115 group=0 level=0 consumed_modifiers=0x6083
13:57:58.638 -> keycode=39 modifiers=0x0004 keyval=115 group=0 level=0 consumed_modifiers=0x6083
13:57:58.638 -> keycode=39 modifiers=0x0004 keyval=115 group=0 level=0 consumed_modifiers=0x6083
13:57:58.638 -> keycode=39 modifiers=0x0004 keyval=115 group=0 level=0 consumed_modifiers=0x6083
13:57:58.740 -> keycode=39 modifiers=0x0004 keyval=115 group=0 level=0 consumed_modifiers=0x6083
13:57:58.742 -> keycode=39 modifiers=0x0004 keyval=115 group=0 level=0 consumed_modifiers=0x6083
13:57:58.864 -> keycode=39 modifiers=0x0004 keyval=115 group=0 level=0 consumed_modifiers=0x6083
13:57:59.244 -> keycode=39 modifiers=0x0004 keyval=115 group=0 level=0 consumed_modifiers=0x6083
13:57:59.244 -> keycode=39 modifiers=0x0004 keyval=115 group=0 level=0 consumed_modifiers=0x6083
13:57:59.245 -> keycode=39 modifiers=0x0004 keyval=115 group=0 level=0 consumed_modifiers=0x6083
13:57:59.245 -> keycode=39 modifiers=0x0004 keyval=115 group=0 level=0 consumed_modifiers=0x6083
13:57:59.348 -> keycode=39 modifiers=0x0004 keyval=115 group=0 level=0 consumed_modifiers=0x6083
13:57:59.476 -> keycode=39 modifiers=0x0004 keyval=115 group=0 level=0 consumed_modifiers=0x6083
13:57:59.976 -> keycode=39 modifiers=0x0004 keyval=115 group=0 level=0 consumed_modifiers=0x6083
13:57:59.981 -> keycode=39 modifiers=0x0004 keyval=115 group=0 level=0 consumed_modifiers=0x6083
13:57:59.982 -> keycode=39 modifiers=0x0004 keyval=115 group=0 level=0 consumed_modifiers=0x6083
13:57:59.982 -> keycode=39 modifiers=0x0004 keyval=115 group=0 level=0 consumed_modifiers=0x6083

First three lines are a first attempt, unsuccessfull. Upon the second attempts, I pressed a few times again and reproduced. Over all, the log for a few seconds contains 136 occurrences of those keycode = 39 lines.

Attached file ctrl_s_gtk.zip

This is direct output, performing only two/three consecutive CTRL+s on the keyboard.

Disabling "Key repeat" in GNOME Control Center's Accessibility menu (Universal Access > Typing > Repeat Keys), I cannot reproduce anymore. This is one of the documented STR of https://github.com/ueno/ibus-skk/issues/64 being referenced by https://gitlab.gnome.org/GNOME/mutter/-/issues/203.

As soon as I enable again the feature, I can reproduce.

(In reply to Alexandre LISSY :gerard-majax from comment #16)

This code should prevent us from doing bad things https://searchfox.org/mozilla-central/rev/fadd0a14d2a2724ee4733ef73970a2ddd457a43f/widget/gtk/nsFilePicker.cpp#351, but I can see we dont hit https://searchfox.org/mozilla-central/rev/fadd0a14d2a2724ee4733ef73970a2ddd457a43f/widget/gtk/nsFilePicker.cpp#515 when the issue reproduces.

This is simply because we get actual CTRL+s events so we issue a whole new flow of "Save as" from https://searchfox.org/mozilla-central/rev/fadd0a14d2a2724ee4733ef73970a2ddd457a43f/toolkit/content/contentAreaUtils.js#108-151

Amin, what can we do to move forward on that issue ?

Flags: needinfo?(bandali)
Duplicate of this bug: 1847238
Duplicate of this bug: 1811989
Duplicate of this bug: 1847809

For what it's worth: this reproduces in flatpak-installed Firefox as well (on Ubuntu 22.04 at least).

Blocks: flatpak
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Unspecified → Linux
Summary: Ctrl+S shortcut-key triggers too many XDG portal window when running on Xwayland leading to resources exhaustion → Ctrl+S and Ctrl+O shortcut-keys trigger too many XDG portal window when running on Xwayland, leading to resources exhaustion
Version: Firefox 101 → Trunk
See Also: → 1849300
Duplicate of this bug: 1863209
Duplicate of this bug: 1851104
Duplicate of this bug: 1868024
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: