Closed Bug 1815929 Opened 3 years ago Closed 3 years ago

Context menus and select menus are incredibly slow

Categories

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

Firefox 111
Unspecified
Linux
defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: aravkasi, Unassigned)

Details

Attachments

(1 file)

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

Steps to reproduce:

Open any webpage, and right click the mouse.
Or, go to any webpage that has a select menu, and click on it.

Actual results:

There is a several second lag before the menu shows up.

Expected results:

The menu shows up instantly.

Everything else seems to be working fine in firefox - it's not that the whole browser is slow. For example, clicking on tabs switches to them instantly. The issue also only happens on my linux system, and only on firefox. It works fine on firefox on windows, as well as chromium on linux. I also tried troubleshooting mode, but that did not fix the issue.

OS: Unspecified → Linux

The issue happens on both Firefox Nightly as well as Firefox stable.

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

Thanks for your report!

Please attach your about:support page.
Please run on terminal with MOZ_LOG="Widget:5 WidgetPopup:5" env variable. You should see on the log when mouse click is delivered (mouse button down event) and when popup is opened (nsWindow::Create() and more "WidgetPopup" entries).
Can you check where is the popup creation frozen according to the log?
Thanks.

Flags: needinfo?(aravkasi)
Priority: -- → P2

Also does it affects only web pages content menus or are other popups (hamburger menu, bookmarks etc.) also slow?

Attached file about:support —
about:support

It only affects native context menus and native select menus. Custom context menus (like on discord) still work fine. These are the terminal logs when I right click with the env var:

[Parent 3703: Main Thread]: D/Widget [7f63f874b800]: Button 3 press
[Parent 3703: Main Thread]: D/Widget [7f63f874b800]: nsWindow::CheckForRollup() aAlwaysRollup 0
[Parent 3703: Main Thread]: D/WidgetPopup [7f63ccc0b800]: CaptureRollupEvents() 1
[Parent 3703: Main Thread]: D/WidgetPopup [7f63ccc0b800]: GrabPointer time=0x033e51b9 retry=0
[Parent 3703: Main Thread]: D/WidgetPopup [7f63ccc0b800]:   quit, window not visible, mHasMappedToplevel = 0, mGdkWindow = 7f63cce90420
[Parent 3703: Main Thread]: D/Widget [7f63f874b800]: Button 3 release
[Parent 3703: Main Thread]: D/WidgetPopup [7f63ccc0b800]: nsWindow::Move to 1477 x 762
[Parent 3703: Main Thread]: D/WidgetPopup [7f63ccc0b800]:   bounds 1395 x 822
[Parent 3703: Main Thread]: D/WidgetPopup [7f63ccc0b800]: nsWindow::NativeMoveResize move 1 resize 0 to 1477,762 -> 256 x 202
[Parent 3703: Main Thread]: D/WidgetPopup [7f63ccc0b800]:   store position of hidden popup window
[Parent 3703: Main Thread]: D/WidgetPopup [7f63ccc0b800]: nsWindow::Show state 1 frame Frame(7f63ec229020) menupopup
[Parent 3703: Main Thread]: D/WidgetPopup [7f63ccc0b800]: nsWindow::SetHasMappedToplevel() state 0
[Parent 3703: Main Thread]: D/WidgetPopup [7f63ccc0b800]: nsWindow::NativeShow show
[Parent 3703: Main Thread]: D/WidgetPopup [7f63ccc0b800]:   calling gtk_widget_show(mShell)
[Parent 3703: Main Thread]: D/Widget moz_container_map() [7f63ccc0b800]
[Parent 3703: Main Thread]: D/WidgetPopup [7f63ccc0b800]: nsWindow::OnMap
[Parent 3703: Main Thread]: D/WidgetPopup [7f63ccc0b800]: nsWindow::ConfigureGdkWindow()
[Parent 3703: Main Thread]: D/WidgetPopup [7f63ccc0b800]: nsWindow::SetInputRegion(0, 4)
[Parent 3703: Main Thread]: D/WidgetPopup [7f63ccc0b800]: nsWindow::ConfigureCompositor()
[Parent 3703: Main Thread]: D/WidgetPopup [7f63ccc0b800]:   moz_container_wayland_add_or_fire_initial_draw_callback ConfigureCompositor
[Parent 3703: Main Thread]: D/WidgetPopup [7f63ccc0b800]: nsWindow::ResumeCompositorImpl()
[Parent 3703: Main Thread]: D/WidgetPopup [7f63ccc0b800]: GtkCompositorWidget::EnableRendering() [7f63ccc0b800]
[Parent 3703: Main Thread]: D/WidgetPopup [7f63ccc0b800]:   quit, mIsRenderingSuspended = false
[Parent 3703: Main Thread]: D/WidgetPopup [7f63ccc0b800]:   finished, new GdkWindow 7f63cce90420 XID 0x270005a
[Parent 3703: Main Thread]: D/WidgetPopup [7f63ccc0b800]:   re-position hidden popup window
[Parent 3703: Main Thread]: D/WidgetPopup [7f63ccc0b800]: nsWindow::OnWindowStateEvent for 7f63d8af2060 changed 0x1 new_window_state 0x80
[Parent 3703: Main Thread]: D/WidgetPopup [7f63ccc0b800]: 	early return because no interesting bits changed
[Parent 3703: Main Thread]: D/WidgetPopup [7f63ccc0b800]: nsWindow::OnWindowStateEvent for 7f63ccd7b850 changed 0x1 new_window_state 0x80
[Parent 3703: Main Thread]: D/WidgetPopup [7f63ccc0b800]: nsWindow::SetHasMappedToplevel() state 1
[Parent 3703: Main Thread]: D/WidgetPopup [7f63ccc0b800]: GrabPointer time=0x033e51b9 retry=1
[Parent 3703: Main Thread]: D/WidgetPopup [7f63ccc0b800]: 	quick return because IS_MOZ_CONTAINER(aWidget) is true
[Parent 3703: Main Thread]: D/WidgetPopup [7f63ccc0b800]: configure event 1477,762 -> 256 x 202 scale 1
[Parent 3703: Main Thread]: D/WidgetPopup [7f63ccc0b800]: GetScreenBounds 1477,762 -> 256 x 202, unscaled 1477,762 -> 256 x 202
[Parent 3703: Main Thread]: D/WidgetPopup [7f63ccc0b800]: configure event 1477,762 -> 256 x 202 scale 1
[Parent 3703: Main Thread]: D/WidgetPopup [7f63ccc0b800]: GetScreenBounds 1477,762 -> 256 x 202, unscaled 1477,762 -> 256 x 202
[Parent 3703: Main Thread]: D/WidgetPopup [7f63ccc0b800]: received expose event 7f63cce90420 0x270005a (rects follow):
[Parent 3703: Main Thread]: D/WidgetPopup [7f63ccc0b800]: Button 1 press

I think the delay happens between the nsWindow::CheckForRollup() aAlwaysRollup 0 line and the CaptureRollupEvents() 1 line.

Flags: needinfo?(aravkasi)

Can you use Firefox profilee the collect performance data between click and menu appearance?
https://fedoraproject.org/wiki/How_to_debug_Firefox_problems#Firefox_performance_issues
Thanks.

Flags: needinfo?(aravkasi)
Flags: needinfo?(aravkasi)

According to profile:

https://profiler.firefox.com/public/d48erfrjet7zbtew5d2fh69mh8hfx88wwk25n78/flame-graph/?globalTrackOrder=01&range=4386m196&thread=0&v=8

the delay is caused by libcanberra library. That library is used to play desktop sound effects.
You may try to disable it: https://wiki.archlinux.org/title/Libcanberra
or uninstall it.

Whoa, the issue got fixed!! Thank you so much - this makes the firefox experience significantly better, the issue was really annoying me! I just disabled it in gtk config and now the lag is gone.

Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: