Closed Bug 2079668 Opened 1 month ago Closed 12 days ago

[Wayland] Firefox UI freezes when the WebAuthn security key prompt appears (AMD radeonsi, hardware WebRender)

Categories

(Core :: Widget: Gtk, defect)

defect

Tracking

()

RESOLVED FIXED
162 Branch
Tracking Status
firefox-esr153 --- unaffected
firefox157 --- unaffected
firefox158 --- wontfix
firefox159 --- wontfix
firefox160 --- wontfix
firefox161 --- fixed
firefox162 --- fixed

People

(Reporter: allstars.chh, Assigned: stransky)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression)

Attachments

(6 files, 3 external files, 2 obsolete files)

49.35 KB, text/plain
Details
13.04 KB, text/plain
Details
23.45 KB, application/gzip
Details
5.94 MB, application/gzip
Details
31.28 KB, text/plain
Details
29.77 KB, text/plain
Details

Yubikey is NOT required to reproduce this bug.

Step to reproduce:

  1. visit https://demo.yubico.com/webauthn-technical/registration
  2. click "Next"
  3. Then Firefox hangs

Normally it will pop up a dialog saying "Touch your security key to continue with ... ", but the dialog doesn't show up.

If I switch to X11, then this problem is gone.

Set release status flags based on info from the regressing bug 2070729

:stransky, since you are the author of the regressor, bug 2070729, could you take a look?

For more information, please visit BugBot documentation.

Flags: needinfo?(stransky)

I'm unable to reproduce on latest nightly & Fedora 44 & Gnome.
Please attach your about:support page.

When Firefox hangs, please try to get backtrace of the hang:
https://fedoraproject.org/wiki/Debugging_guidelines_for_Mozilla_products#Application_freeze
(Please use official binaries for it:
https://fedoraproject.org/wiki/How_to_debug_Firefox_problems#Testing_Mozilla_binaries)

Thanks.

Flags: needinfo?(stransky) → needinfo?(allstars.chh)
Flags: needinfo?(allstars.chh)

This bug is only reproducible on Plasma Wayland, GNOME Wayland doesn't have this problem.

My other machine (Dell XPS 14) has the same Ubuntu 24.04, the same KDE plasma version 5.27.12, but doesn't have this problem.

The problem is reproducible on my machine (Lenovo P620) with AMD GPU AMD radeonsi

I see, Thanks. Looks like we hit a bug/deadlock in AMD drivers when we delete a popup and destroy compositor (at least it looks like from the BT) and we're blocked in display roundtrip.

A workaround may be to remove the explicit commit from popup and keep it for toplevel only but it may be worth to investigate the AMD deadlock and report upstream. Do you mind to install mesa debug info packages and try to catch the bt again with debug symbols?

Thanks.

Flags: needinfo?(allstars.chh)

Could you also capture a Wayland protocol log of the hang?

Close Firefox Nightly completely, then start it from a terminal with:

WAYLAND_DEBUG=client firefox-nightly 2> ~/wayland-debug.log

Reproduce the hang on the Yubico demo page, wait about 10 seconds, then press Ctrl+C in the terminal.

Severity: -- → S3

It confuses me why we're hitting HW compositing bug while we don't use HW rendering for popups:
https://searchfox.org/firefox-main/rev/23fd2ecbdb459f63606a188fdea2d4dbee05507c/widget/gtk/nsWindow.cpp#657

Which also leads to question if we create EGLWindow even if it's not used:
https://searchfox.org/firefox-main/rev/23fd2ecbdb459f63606a188fdea2d4dbee05507c/widget/gtk/nsWindow.cpp#4279

Flags: needinfo?(stransky)

Yoshi Cheng-Hao Huang,
please also run on terminal with MOZ_LOG="Widget:5,WidgetPopup:5", reproduce the issue and attach the log here (terminate Firefox by CTRL+C when it's frozen).
Thanks.

(In reply to Thinker Li [:sinker] from comment #8)

Could you also capture a Wayland protocol log of the hang?

Close Firefox Nightly completely, then start it from a terminal with:

WAYLAND_DEBUG=client firefox-nightly 2> ~/wayland-debug.log

Reproduce the hang on the Yubico demo page, wait about 10 seconds, then press Ctrl+C in the terminal.

Please check wayland-debug-[trimmed|full].log.gz

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

It confuses me why we're hitting HW compositing bug while we don't use HW rendering for popups:
https://searchfox.org/firefox-main/rev/23fd2ecbdb459f63606a188fdea2d4dbee05507c/widget/gtk/nsWindow.cpp#657

Which also leads to question if we create EGLWindow even if it's not used:
https://searchfox.org/firefox-main/rev/23fd2ecbdb459f63606a188fdea2d4dbee05507c/widget/gtk/nsWindow.cpp#4279

The popup is #notification-popup, which has "remote=true"
https://searchfox.org/firefox-main/rev/3f373ae59cb09e60f4044f9bb37fe27247986234/browser/base/content/popup-notifications.inc.xhtml#14

So the WebAuth prompt gets an EGL surface and goes through Mesa

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

Yoshi Cheng-Hao Huang,
please also run on terminal with MOZ_LOG="Widget:5,WidgetPopup:5", reproduce the issue and attach the log here (terminate Firefox by CTRL+C when it's frozen).
Thanks.

comment 15, nightly_moz_log_Widget_WidgetPop.txt

I also noticed that my debug build won't have this hang problem, so it looks this is a timing problem?

Have you checked whether this is a regression or happens in a new profile?

Yes, looks like a race in drivers and our GL code. We may fix that by just delayed webrender delete to clear it after unmap - we call it from main thread from the unmap event right now and it's blocking call. But it may be worth to investigate the underlying issue in AMD/MESA drivers.

(In reply to Kagami Rosylight 🏳️‍🌈🏳️‍⚧️ [:saschanaz] (they/them) from comment #17)

Have you checked whether this is a regression or happens in a new profile?

Originally I ran into from my Nightly released from Ubuntu package firefox-trunk
Then I tried the official nightly build from Mozilla.
I also tried building from latest m-c with optimized enabled
All of them reproduce this problem. So this doesn't relate to an existing profile or a new one.

I thought this was a regression from bug 2070729, but maybe it's just that bug increased the chance of the race condition somewhere.

Assignee: nobody → stransky
Status: NEW → ASSIGNED

I wonder if that's caused by old MESA. The KDE 5.X/MESA 25.x is a bit outdated, the recent line is 26.x.

Flags: needinfo?(stransky)
Pushed by sstanca@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/bc2837f46d2c https://hg.mozilla.org/integration/autoland/rev/d500e3581606 Revert "Bug 2079668: apply code formatting via Lando" for causing Linux Wayland mochitests-plain failures.

Reverted this because it was causing Linux Wayland mochitests-plain failures.

Flags: needinfo?(stransky)

Looks like what we hit at Bug 2002206 when we tried to remove it. For some reason mochitest loves the hack.

See Also: → 2002206
Attachment #9661259 - Attachment description: Bug 2079668 [Linux] Don't delete GL resources on popup unmap r?emilio → Bug 2079668 [Linux] Don't delete LayerManager on popup unmap r?emilio

Hi Martin:
I tried your patches, but unfortunally the problem (comment 0) still exists.

Thanks for testing. Please try the updated ones - I removed the layer manager destroy completely.
If you see the hang with it please attach gdb backtrace from the freeze again - would be great to have bt from the mesa lib, can you install debug info packages for it?
Thanks.

Flags: needinfo?(stransky) → needinfo?(allstars.chh)
Flags: needinfo?(stransky)

Thanks. The log is good, it shows mesa is just waiting to compositor to return used wl_buffer, it's not related to any particular Firefox code although some pattern may make it more visible. Plasma 5.x is not Wayland stable, please update to 6.x line.

I have a patch for it but need to wait after phabricator outage.

Hm, the try doesn't look much better although seems to crash/fail on different place. May be fixed by modified composition destroy on ::Destroy().

See Also: → 2088176
Duplicate of this bug: 2088176

I can reproduce that on KDE 6.8 / Fedora 45. I expected to be 5.x bug but looks like a recent one. Also HDR mode makes it more likely but I can see it without it too. Looks like it affects the popups opened without user interaction only, i.e. when the popup is opened by Firefox itself.

Maybe we juts missing event processing somewhere which causes the lock? User action (mouse click) may trigger the event loop which may 'fix' it.

Hm, the patches above don't address that at all, I can reproduce it with them too.

Confirmed the Bug 2070729 revert fixes it but I still have no idea why it affects the popups only.

Flags: needinfo?(stransky)
Keywords: leave-open
Flags: needinfo?(stransky)
Pushed by stransky@redhat.com: https://github.com/mozilla-firefox/firefox/commit/05f067e3f41a https://hg.mozilla.org/integration/autoland/rev/b8c02e9a3428 [Linux] Don't create EGLWindow for non-accelerated nsWindow r=emilio,gtk-reviewers

So it's generally a dupe of Bug 2081642 but just for the toplevel commit.
So the correct fix for Bug 2080307 / https://phabricator.services.mozilla.com/D332610 is to cache the opaque region, ignore force commit and commit everything together when we're mapped.
We can't apply the force commit to unmapped windows.

Attachment #9661259 - Attachment is obsolete: true
Attachment #9668486 - Attachment is obsolete: true

Let's keep the patch here minimal for uplift and fix the opaque region commit at Bug 2089544.

Flags: needinfo?(stransky)
See Also: → 2089544
Status: ASSIGNED → RESOLVED
Closed: 12 days ago
Resolution: --- → FIXED
Target Milestone: --- → 162 Branch

Since nightly and release are affected, beta will likely be affected too.
For more information, please visit BugBot documentation.

The patch landed in nightly and beta is affected.

:stransky, please make an uplift decision for beta:

  • For beta, nominate the patch for beta uplift approval if the fix should be included in this release, or set status-firefox161 to wontfix if the fix can wait for the next release.

Uplift requests can be submitted from Lando: D333159, D339973.

See Requesting an Uplift for documentation on how to request an uplift.

For more information, please visit BugBot documentation.

Flags: needinfo?(stransky)
Attachment #9677670 - Flags: approval-mozilla-beta?

firefox-beta Uplift Approval Request

  • User impact if declined/Reason for urgency: Missing popup windows on Wayland
  • Code covered by automated testing?: no
  • Fix verified in Nightly?: no
  • Needs manual QE testing?: no
  • Steps to reproduce for manual QE testing:
  • Risk associated with taking this patch: low
  • Explanation of risk level: Ignore force redraw of hidden windows
  • String changes made/needed?: none
  • Is Android affected?: no
Attachment #9677670 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

Clearing the uplift needinfo request since an uplift has been requested for all the affected channels.

For more information, please visit BugBot documentation.

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

Attachment

General

Created:
Updated:
Size: