Closed Bug 1897765 Opened 1 year ago Closed 1 month ago

Network requests in background tabs where devtools is open jank the parent process main thread

Categories

(DevTools :: Netmonitor, defect, P2)

defect

Tracking

(firefox144 fixed)

RESOLVED FIXED
144 Branch
Tracking Status
firefox144 --- fixed

People

(Reporter: florian, Assigned: ochameau)

References

Details

(Keywords: perf:resource-use, perf:responsiveness)

Attachments

(1 file)

What were you doing?

Please tell us what site you were on, and what steps led to the error you are reporting

  1. Open 2 tabs with code in them that does an XHR every 5 seconds.
  2. Open devtools in each of them. I think I had one with the network tab selected, and the other one with the console selected.
  3. Open a third tab, put it in the foreground.
  4. Capture a profile to see what's happening.

What happened?

https://share.firefox.dev/3wFKKSo showing:

What should have happened?

No jank, no significant graphics activity for devtools in background tabs.

Do you have extensions installed?

CORS Everywhere was installed. I don't think it plays a role here.

Thanks for the report Florian. Did this happen immediately, or did you have to wait for several hours/days before the jank started?

Flags: needinfo?(florian)
See Also: → 1897187
Severity: -- → S3
Priority: -- → P2

(In reply to Julian Descottes [:jdescottes] from comment #1)

Thanks for the report Florian. Did this happen immediately, or did you have to wait for several hours/days before the jank started?

There were already a few thousand network requests in each tab, so probably at least a few hours.

Flags: needinfo?(florian)

The Bugbug bot thinks this bug should belong to the 'DevTools::Netmonitor' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: General → Netmonitor

By removing the call to React forceUpdate, bug 1943364 may help speedup this scenario.

One thing to consider here is that in this scenario we don't really toggle the visibility of an existing panel, so forceUpdate was probably not applied. We basically have 3 tabs:

  • two in the background:
    • one with devtools open on the console, on a page which does many requests, and a hidden netmonitor
    • another one with devtools open on the netmonitor, on the same page
  • another foreground tab, on another page

And in this scenario, visibility handler will not detect that the panel is "hidden" because the owner tab is in the background. It's only triggered if the selected devtools panel changes. But maybe other improvements made recently will help. Testing on a recent central seems to show improvement compared to a 3 days old nightly.

See Also: → 1405342

Start using docShellIsActive on toolbox's <browser> element.
This attribute controls the document.visibilityState attribute
which is used by DevTools panels to stop doing React updates when a panel is hidden.

We synchronize docShellIsActive value with the debugged's tab <browser> element.

Unfortunately, this attribute can only be used on top level <browser> elements,
so that we can't use it against DevTools panels which used nested <xul:iframe>.
We have to keep the workaround in setIframeVisible, while acknowledging
the toolbox's visibility which can now be hidden.

Assignee: nobody → poirot.alex
Attachment #9504088 - Attachment description: WIP: Bug 1897765 - [devtools] Prevent doing React updates when DevTools is in a background tab. → Bug 1897765 - [devtools] Prevent doing React updates when DevTools is in a background tab. r=#devtools
Status: NEW → ASSIGNED
Pushed by apoirot@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/08bf53f4758c https://hg.mozilla.org/integration/autoland/rev/642551f72e56 [devtools] Prevent doing React updates when DevTools is in a background tab. r=devtools-reviewers,jdescottes,nchevobbe
Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 144 Branch
Duplicate of this bug: 1880744
QA Whiteboard: [qa-triage-done-c145/b144]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: