Storage folders of containers removed with contextualIdentities.remove aren't deleted
Categories
(Core :: Storage: Quota Manager, defect, P3)
Tracking
()
People
(Reporter: andremonizbr, Assigned: tt)
Details
(Whiteboard: [domsecurity-backlog1])
Attachments
(5 files, 2 obsolete files)
Comment 1•6 years ago
|
||
Comment 2•6 years ago
|
||
Comment 3•6 years ago
|
||
Updated•6 years ago
|
Comment 4•6 years ago
|
||
Same for me, and to make it more exciting about:newtab
creates an SQLite database. I'm not sure if this is still the case, but a couple of months ago I had thousands of these newtab
databases lying around, each 5Mb, which ate a decently large chunk of my hard drive.
I've been using a small shell script to manually delete these files, but that's fragile, especially since extension data got moved to the same folder.
function clean-firefox-containers -d "Removes storage from old temporary containers"
set -l storage_dir ~/Library/Application\ Support/Firefox/Profiles/*.default/storage/default
find $storage_dir -name "http*^userContextId=????*" | xargs rm -r
find $storage_dir -name "about+newtab^userContextId=*" | xargs rm -r
end
Max, I no longer feel alone in this world. I've lost my extensions settings because of a similar PowerShell script I've been using since I opened this issue. Here's the fixed version:
Get-ChildItem -path "C:\Users\123\AppData\Roaming\Mozilla\Firefox\Profiles\123\storage\default" | Where{$_.Name -Match "userContextId|instagram|gazeta|github.io|globo|googleusercontent|yandex"} | Where{$_.Name -NotMatch "moz-"} | Remove-Item -Recurse
I'm adding some domains manually too because another Firefox limitation prevents Cookie AutoDelete from deleting some kind of storage created by tabs not in containers (IndexedDB
, I think).
Comment 6•6 years ago
|
||
Maybe janv knows more about what is happening here.
When a container is removed, we call: Services.clearData.deleteDataFromOriginAttributesPattern({ userContextId });
https://searchfox.org/mozilla-central/rev/6c9f60f8cc064a1005cd8141ecd526578ae9da7a/toolkit/components/contextualidentity/ContextualIdentityService.jsm#298
Why do we still have container-related folders in the user profile directory?
Comment 7•6 years ago
|
||
I think changes by Tom and Jan here to origin clearing in 68 should cause these directories to be removed, but redirecting to Tom to confirm and/or further analysis.
Assignee | ||
Comment 8•6 years ago
|
||
(In reply to Andrea Marchesini [:baku] from comment #6)
When a container is removed, we call: Services.clearData.deleteDataFromOriginAttributesPattern({ userContextId });
https://searchfox.org/mozilla-central/rev/6c9f60f8cc064a1005cd8141ecd526578ae9da7a/toolkit/components/contextualidentity/ContextualIdentityService.jsm#298
This should be observed by QMS [1], IIUC.
While trying to reproduce the issue, I found QMS didn't receive the message. I wonder if it hasn't been initialized/registered or something else so that it didn't propagate the message to the QM. I'll look into it more.
(In reply to Andrew Sutherland [:asuth] (he/him) from comment #7)
I think changes by Tom and Jan here to origin clearing in 68 should cause these directories to be removed, but redirecting to Tom to confirm and/or further analysis.
Yes, that's https://bugzilla.mozilla.org/show_bug.cgi?id=1529122. If the folder is empty, it would be removed in 68.
Assignee | ||
Comment 9•6 years ago
|
||
Assignee | ||
Updated•6 years ago
|
Comment 10•6 years ago
|
||
See also bug 1537882. The category entry doesn't work there too.
Assignee | ||
Comment 11•6 years ago
|
||
Updated•5 years ago
|
Assignee | ||
Comment 12•5 years ago
|
||
Depends on D33758
Assignee | ||
Comment 13•5 years ago
|
||
Depends on D34324
Assignee | ||
Comment 14•5 years ago
|
||
Depends on D33758
Updated•5 years ago
|
Assignee | ||
Comment 15•5 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=b813597a265c702db717d1ed39341a2afcafc137
I will ask one more review when the result of the try is good.
Assignee | ||
Comment 16•5 years ago
|
||
(In reply to Tom Tung [:tt, :ttung] from comment #15)
https://treeherder.mozilla.org/#/jobs?repo=try&revision=b813597a265c702db717d1ed39341a2afcafc137
I will ask one more review when the result of the try is good.
I need to make the test security/manager/ssl/tests/unit/test_sss_sanitizeOnShutdown.js pass. A fix for that should be in another patch.
Assignee | ||
Comment 17•5 years ago
|
||
(In reply to Tom Tung [:tt, :ttung] from comment #16)
I need to make the test security/manager/ssl/tests/unit/test_sss_sanitizeOnShutdown.js pass. A fix for that should be in another patch.
Hmm, so this seems to be a complicated issue:
- sanitizeOnShutdown seems to be triggered by "profile-change-teardown"
- If the SWM hasn't been initialized yet, it would be lazily initialized in Services.clearData.deleteDataFromOriginAttributesPattern because of the change in D33758
- SWM::Init will add a shutdown blocker and the will be removed when it gets the topic "profile-change-teardown". (But I suspect, in this case, it won't because the topic has already fired)
- Because the added blocker is not removed, it blocks the process of shutting down.
- I need to check if this scenario occurs in other functions for clearData
If the sequence is not expected, SWM would just block the shutdown after the change I made in this bug.
Maybe a solution is not to init the SWM if it hasn't been initialized.
Assignee | ||
Comment 18•5 years ago
|
||
The test starts timed out after applying the changes in P1-P3. The main reason is that P1-P3 ensure SWM and the QuotaManger clear their storage in any condition in clear data service. However, since the SWM adds a shutdown blocker during the initialization and it's initialized during the profile-change-teardown because of the changes and the test scenario.
To fix that, ideally, SWM should differentiate if it's initialized before or during the profile-change-teardown and that requires a non-small change. Since we haven't got this signature in the real world and similar cases (SWM gets initialized during profile-change-teardown) have been taken care of, this patch only adds a workaround to avoid the issue.
Depends on D34325
Updated•5 years ago
|
Assignee | ||
Comment 19•5 years ago
|
||
Comment 20•5 years ago
|
||
Comment 21•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/20dbddeeb3a6
https://hg.mozilla.org/mozilla-central/rev/51ddf8bf0847
https://hg.mozilla.org/mozilla-central/rev/ea125fda1920
https://hg.mozilla.org/mozilla-central/rev/bd7b2d89fa96
Updated•5 years ago
|
Description
•