browser permanently hangs when logging tons of stuff
Categories
(DevTools :: Console, defect, P2)
Tracking
(Not tracked)
People
(Reporter: fitzgen, Unassigned)
References
(Blocks 3 open bugs)
Details
(Keywords: perf, Whiteboard: [console-papercuts][polish-backlog])
Attachments
(3 files)
Reporter | ||
Comment 1•10 years ago
|
||
Reporter | ||
Comment 2•10 years ago
|
||
Comment 3•10 years ago
|
||
Updated•10 years ago
|
Comment 4•10 years ago
|
||
Comment 5•10 years ago
|
||
Comment 6•10 years ago
|
||
Updated•10 years ago
|
Updated•10 years ago
|
Updated•10 years ago
|
Updated•9 years ago
|
Comment 7•9 years ago
|
||
Updated•6 years ago
|
Comment 8•6 years ago
|
||
Comment 9•6 years ago
|
||
Comment 10•6 years ago
|
||
Comment 11•6 years ago
|
||
Updated•5 years ago
|
Comment 12•4 years ago
•
|
||
(retriaging "flexbox-perf-issues" dependencies)
Here's a profile I captured of this today (following STR from comment 0, except using the Web Console instead of the Scratchpad since the scratchpad isn't a thing anymore):
https://share.firefox.dev/3fmCmZw
(Note: I had to close the tab in order to be able to capture a profile and to avoid letting the runaway logging completely lock up the browser.)
Observations:
-
Focusing on 0-30s (which I thinks is the time up until I closed the tab), there are repeated "batches of work", with each batch progressively more time-consuming than the previous one. (As I recall, this may be due to some webconsole behavior where we clamp the amount of log output, and we repeatedly double the clamp-limit over time, or something like that?)
-
The reflow/restyle time in the longer batches is substantial, but the vast majority of the time is JS (E.g. in the last/longest batch from 12s-27s, we do 1.2s of reflow and 500ms of restyle at the very end, after ~13 seconds of JS/DOM operations)
-
I would guess that this growing reflow/restyle time is consistent with the growing amount of content that we're logging per-"batch".
Conclusion: it doesn't look like the reflow performance here is a significant part of the jank to narrow in on -- and it seems consistent with what I might expect from churning out progressively-larger batches of log lines to be laid out all at once.
To really address this bug, I think we would need to focus in on the more expensive things that are happening in the profile; and to improve the relatively-small-part that is the layout performance, I think we would probably want a frontend change in the web console (stricter clamping on the number of lines that can be logged at once, for example; and/or stricter clamping on the upper limit of lines that we'll allow to be shown; or some sort of virtual impl that only attempts to lay out some upper-limit number of lines.)
So: I'm dropping the "flexbox-perf-issues" dependency since it's not clear that there's a flexbox perf problem to be addressed here, at this point. (There may be one for other webconsole bugs, but I'm not seeing one here; as noted above, the reflow times seem consistent with giant amounts of content being added at once and needing to be laid out.)
Updated•2 years ago
|
Comment 13•10 months ago
|
||
(In reply to Daniel Holbert [:dholbert] from comment #12)
To really address this bug, I think we would need to focus in on the more expensive things that are happening in the profile; and to improve the relatively-small-part that is the layout performance, I think we would probably want a frontend change in the web console (stricter clamping on the number of lines that can be logged at once, for example; and/or stricter clamping on the upper limit of lines that we'll allow to be shown;
or some sort of virtual impl that only attempts to lay out some upper-limit number of lines.)
Note that this has been implemented in bug 1753177 (virtual viewport).
A new profiler record with today's mozilla-central:
https://share.firefox.dev/41Pjfkj
There is surely something to do around massive usage of Array.includes on large arrays.
We spend almost 3second checking for inclusion in this 21s profile.
Otherwise resource throttling would probably help reduce the cost of JSActor messages as well as the overall overhead of RDP.
And in the content process, the generation of object grip might be able to be optimized (_populateGripPreview
).
Comment 14•10 months ago
•
|
||
(In reply to Alexandre Poirot [:ochameau] from comment #13)
There is surely something to do around massive usage of Array.includes on large arrays.
We spend almost 3second checking for inclusion in this 21s profile.
More detail on this point -- in at least one jank section, here:
https://share.firefox.dev/47mrPYT
...we have 357 samples in Array.prototype.includes
, which seems to be split between two portions:
(1) Calls inside of removeMessagesFromState/state.messagesUiById
calling isInRemovedId
(160 samples), here:
https://searchfox.org/mozilla-central/rev/762f24e00a9548d80ebba1b985c871ba6d9b829d/devtools/client/webconsole/reducers/messages.js#1022
(2) Calls inside of UNSAFE_componentWillUpdate
(197 samples), here:
https://searchfox.org/mozilla-central/rev/762f24e00a9548d80ebba1b985c871ba6d9b829d/devtools/client/webconsole/components/Output/ConsoleOutput.js#190-194
In both cases it looks like we've probably got a massive array of messages, and we're spending time traversing it to satisfy this includes()
check. (not sure if this is one extremely-slow traversal vs. many traversals which collectively eat up lots of time).
Comment 15•10 months ago
|
||
Maybe we should resolve this as FIXED by bug 1753177, and spin off a new bug for the remaining less-substantial jank?
(The title of this bug, "browser permanently hangs", is much worse than the ~1s periodic janks shown in the latest profile here.)
Updated•10 months ago
|
Comment 16•10 months ago
|
||
Overall fixed by bug 1753177 (virtual viewport for the console).
(In reply to Daniel Holbert [:dholbert] from comment #15)
Maybe we should resolve this as FIXED by bug 1753177, and spin off a new bug for the remaining less-substantial jank?
(The title of this bug, "browser permanently hangs", is much worse than the ~1s periodic janks shown in the latest profile here.)
We are at 1s freeze every 2-3s. So this is still serious and useful STR to keep investigating.
But I agree, for sake of clarity, I opened bug 1873065 on the various things highlighted in the profiler and bug 1873066 to especially focus on Array.includes.
Description
•