Open Bug 1923881 Opened 2 years ago Updated 2 years ago

Repeatedly refreshing certain webpages causes tab to stop responding (without using any CPU/GPU. Doesnt repro on Chrome.)

Categories

(Core :: DOM: Networking, defect, P3)

Firefox 131
defect

Tracking

()

People

(Reporter: david.turner, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [necko-triaged])

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

Steps to reproduce:

  • Load https://cpulator.01xz.net/?sys=arm
  • Wait for page to finish loading
  • Repeatedly click the "reload" / "stop" button a few times a second without waiting for the page to load

(Reproduced with Firefox 130.0 on Raspberry Pi OS Bookworm on Raspberry Pi 5, and on Firefox 131.0 on Debian Bookworm x86_64, and on Firefox 131.0 on Windows 10)

Original bug report is at https://github.com/raspberrypi/bookworm-feedback/issues/302, but I can also reproduce the problem so happy to be the corresponding author.

Actual results:

After a few seconds the tab becomes unresponsive - clicking on anything on the page has no effect and clicking the reload button does nothing. Trying to navigate to a different URL via the address bar also does nothing. Closing the tab and re-opening a new tab, everything works fine again.

Expected results:

The page should reload as many times as you like without the tab becoming unresponsive.

I've just tried to localise this with mozregression but it happens as far back as the stable 120.0 release and as late as today's (2024-10-10) nightly. Mozregression doesn't seem to want to run builds older than 120.0 for me.

I can't replicate on macOS, no matter how many times I reload the page.

Can you try capturing a profile?
https://profiler.firefox.com/

Flags: needinfo?(david.turner)

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

Strange, I just tested on Firefox 131.0.2 on MacOS monterey (early 2015 macbook air) and saw the issue.

Profile here: https://share.firefox.dev/3NmueeC

Thanks, let's see if someone from Performances has any hint on the problem.

Component: Widget: Gtk → Performance
Flags: needinfo?(david.turner)

I can repro on release 131 on Win11x64.
Let me get some profile and a regression range if possible.
And I can repro on Nightly.

I can repro on a build from Jan2021. Before that, the page doesnt load properly.

I get this message in the console:
initMouseEvent() is deprecated. Use the MouseEvent() constructor instead. cpulator.min.js:127:105
20:40:42.661 injected firefox content.js:142:11
20:40:42.875 CPUlator startup complete: 1512 ms cpulator.min.js:288:196
20:40:42.876 Worker thread started: 239 ms thread.min.js:19:185
20:40:47.009 Use of navigator.sendBeacon instead of synchronous XMLHttpRequest during unload and pagehide improves user experience.

So potentially SW worker related??

Status: UNCONFIRMED → NEW
Ever confirmed: true

Doesnt repro on Chrome. Tab doesnt use any CPU/GPU when it hangs.
Profile with everything the profiler can capture : https://share.firefox.dev/3ZYEi4Y
I am moving this out from core:performance.
cc :asuth just in case there is anything SW related. And cc :jeff.

Component: Performance → General
Summary: Repeatedly refreshing certain webpages causes tab to stop responding → Repeatedly refreshing certain webpages causes tab to stop responding (without using any CPU/GPU. Doesnt repro on Chrome.)

(In reply to Mayank Bansal from comment #7)

Profile with everything the profiler can capture : https://share.firefox.dev/3ZYEi4Y

I see a sync XHR that seems to be waiting for the server to respond fired during the unload event. Webpages that issue sync XHRs are choosing to make the page unresponsive until the XHR completes. Implementation-wise the sync XHR explicitly suspends input. It seems like there may be an attempt to set a 20 second manual timeout using setTimeout, but that would only work for an async XHR. An interesting question is whether the site has some kind of anti-DoS protection that means if you keep hitting reload it views you as an attacker and starts tarpitting your connections.

I believe per https://developer.chrome.com/docs/web-platform/deprecating-unload that Chrome may no longer fire the unload event at this point, so they would not be affected.

Bug 1542967 seems to be the idle proposal for us to prevent sync XHR in cases like this.

Moving to DOM: Networking based on comment 8

Component: General → DOM: Networking
Blocks: xhr
Severity: -- → S4
Priority: -- → P3
Whiteboard: [necko-triaged]
You need to log in before you can comment on or make changes to this bug.