Closed Bug 1733120 Opened 3 years ago Closed 3 years ago

Site data storage usage increases upon opening site in multiple tabs, using only localStorage with the same keys

Categories

(Core :: Storage: localStorage & sessionStorage, defect)

Firefox 92
defect

Tracking

()

RESOLVED DUPLICATE of bug 1733054

People

(Reporter: jhuang, Unassigned)

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36

Steps to reproduce:

Open a site like: https://mdn.github.io/dom-examples/web-storage/index.html
Interact with UI on site, e.g. select one of the drop downs.
Right click on browser tab and select 'Duplicate' from context menu.
Duplicate site multiple times.

Actual results:

When opening 'Manage Data' under 'about:preferences#privacy' and checking storage size, the size for the site increases upon opening the site in new tabs. Also the site uses less than 1kb of localStorage only, whereas the site data shows a greater initial number of 128kb and increases up to 5.0Mb upon opening the site in multiple tabs.

Expected results:

When opening multiple tabs, site data should remain the same and reflect true size, as only localStorage is being used, with the same keys being set. Chrome browser does not show usage increasing when viewing the same site in multiple tabs. Attached is a screenshot

multiple tabs in Chrome browser shows usage of 63 b

Summary: Site data storage usage increases upon opening site in multiple tabs → Site data storage usage increases upon opening site in multiple tabs, using localStorage only with same keys

The Bugbug bot thinks this bug should belong to the 'Core::Storage: localStorage & sessionStorage' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → Storage: localStorage & sessionStorage
Product: Firefox → Core
Summary: Site data storage usage increases upon opening site in multiple tabs, using localStorage only with same keys → Site data storage usage increases upon opening site in multiple tabs, using only localStorage with the same keys

This appears to be similar to 1673276 & 1733054

The severity field is not set for this bug.
:janv, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(jvarga)

I believe the usage will go down after 20 seconds of inactivity, but it seems we will have to adjust some internal constants.

Just to verify my theory, can you set this preference dom.storage.snapshot_reusing to false ?
Also, you need to close and re-open the tab with preferences to see refreshed size in "Manage Data".

Changing the dom.storage.snapshot_reusing to false seems to work.
If snapshot_reusing is true, the storage usage grows for each new tab, but when it's false, the usage stays the same.

Same results here, the storage usage stays around it's initial size and does not increase to 5mb when setting dom.storage.snapshot_reusing to false.

BTW, thank you :janv for your attention to this issue! Also, what determines inactivity? Does it require all instances of tabs with the site to be closed? Ideally it would be when tabs are open, but not actively selected and in the background. When dom.storage.snapshot_reusing is true, keeping a site open in multiple inactive tabs in the background while on a different site in a another tab, the storage does not go down for the site in the inactive tabs no matter how long.

I meant that if there are no setItem, getItem, etc. calls, an internal snapshot which keeps some cached data and also pre-allocates some quota for immediate use (128KB currently), will be destroyed after 20 seconds. This is all done to improve performance.

However, it seems we need to tweak some of these constants or just switch dom.storage.snapshot_reusing to false by default, I need to discuss with the team.

Ah, got it, thank you for the info. One of our sites has a localStorage item that gets set every few seconds, this probably keeps the snapshot from being destroyed.

Hi, any chance this issue or bug 1673276 & bug 1733054 are being tracked and looked into? Much appreciation and thanks in advance!

Yeah, we are working on a solution.

Awesome, that's great to hear, thank you!

Hi, just wanted to follow up, hoping for a sense on timing for when a solution will be available. Thank you!

Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → DUPLICATE

Fixed long time ago.

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

Attachment

General

Creator:
Created:
Updated:
Size: