Autocompleting/Displaying localStorage with lots of entries freezes Firefox
Categories
(DevTools :: Console, defect, P3)
Tracking
(firefox96 verified)
Tracking | Status | |
---|---|---|
firefox96 | --- | verified |
People
(Reporter: alexanderhausmann, Assigned: nchevobbe)
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0
Steps to reproduce:
- store a lot of UTF16 characters in localStorage (~ 3,000,000)
- enter "localStorage" in the Dev Console
Actual results:
Whole firefox freezes (mostly CPU usage, some additional RAM usage) for at least 10 seconds (Ryzen 5900x).
This is especially bad since the autocomplete will try to complete e.g. "localS" to "localStorage" which triggers the freeze
I understand if this cannot be fixed, but at least give me an option to turn off the "return preview" of the console, since the calculation of that preview seems to be the reason for the freeze.
Expected results:
only freeze the tab related to this dev console
Reporter | ||
Updated•3 years ago
|
Comment 1•3 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'DevTools::Console' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.
Comment 2•3 years ago
|
||
Nicolas: can you share the setting to disable instant evaluation and try to reproduce the issue.
Assignee | ||
Comment 3•3 years ago
|
||
Instant evaluation can be disabled from the console settings menu (see screenshot)
I think the issue is caused by https://searchfox.org/mozilla-central/rev/bc5e79f3ae0f42cb4a6ebd05fc32f48a3829059d/devtools/server/actors/object/utils.js#336-343 , where we do loop through all the entries, even if in the end we're only showing a preview of 10 entries in the console :/
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 4•2 years ago
|
||
The function, which is only used from previewers.js to retrieve
the first then interesting properties of an object, has a special
case for (local|session)Storage so we loop through their entries
and not their properties.
We're using storage#key to achieve this, but the problem is that
the function is quite slow, and if the storage object has a lot
of entries, it can end up freezing Firefox.
In order to avoid such freeze, for storage object, we're not returning
an array but an iterable object, which most of the time will only be
called 10 times and prevent any perf issue.
Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1e7a99bf6c17 [devtools] Fix getPropNamesFromObject + storage performance issues. r=jdescottes.
Updated•2 years ago
|
Comment 6•2 years ago
|
||
bugherder |
Updated•2 years ago
|
Comment 7•2 years ago
|
||
Reproduced the bug using an affected Firefox 94.0, on Win 10 x64.
The issue is verified as fixed on 96.0-build2, under Win 10 x64. Thanks, Nicolas, for your help in reproducing this bug.
Description
•