Closed Bug 1800505 Opened 2 years ago Closed 2 years ago

Move cleared origin directories before removal at shutdown

Categories

(Core :: Storage: Quota Manager, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
109 Branch
Tracking Status
firefox109 --- fixed

People

(Reporter: saschanaz, Assigned: saschanaz)

References

Details

Attachments

(1 file)

Failing to remove files e.g. as in bug 1788986 can result in intermediate state where cleared and non-cleared origin directories are not classified, and this requires recomputing quota usage.

If we always move the cleared ones to a temporary directory (regardless of the background task), then we should be able to remove one main cause of such intermediateness.

Note that this does not completely remove the need to recompute since any non-shutdown crash can also cause incorrect quota usage data.

Failing to remove files e.g. as in bug 1788986 can result in intermediate state where cleared and non-cleared origin directories are not classified, and this requires recomputing quota usage.

Hi Jari, does this look accurate to you? Looking at the code, Gecko knows whether the shutdown cleanup failed and retry the failed cleanup at startup again. So in theory the cleanup failure shouldn't require recomputing.

That said, it could still be problematic if the quota manager can start earlier than the sanitizer. Do you know when exactly it starts?

In any case, this patch should make things better for users since the cleared directories will get UUID formatted names even with the shutdown crash (unless anything blocks the directory move).

Flags: needinfo?(jjalkanen)

(In reply to Kagami :saschanaz from comment #2)

Failing to remove files e.g. as in bug 1788986 can result in intermediate state where cleared and non-cleared origin directories are not classified, and this requires recomputing quota usage.

Hi Jari, does this look accurate to you? Looking at the code, Gecko knows whether the shutdown cleanup failed and retry the failed cleanup at startup again. So in theory the cleanup failure shouldn't require recomputing.

That said, it could still be problematic if the quota manager can start earlier than the sanitizer. Do you know when exactly it starts?

In any case, this patch should make things better for users since the cleared directories will get UUID formatted names even with the shutdown crash (unless anything blocks the directory move).

As far as I can see, quota manager delegates part of the usage tracking to the clients. A typical client caches the usage info to a dedicated data store. When there is any kind of a crash, e.g. during a regular write, the information in the data store may go out of sync and to avoid exceeding the quota, we require the clients to scan their directories at startup. Additionally, quota manager has its own cached clientUsage values which also go out of sync.

If there is a sanitizer which detects and retries a failed cleanup at startup again, then the initial scan could probably be bypassed, on the other hand if this mechanism was guaranteed to run before the origin initialization, the scans would be quick as there shouldn't be anything to scan.

Flags: needinfo?(jjalkanen)
Pushed by krosylight@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/5c1d58ffd6b7 Move origin directories before shutdown sanitization r=smaug
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 109 Branch
Pushed by csabou@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/8cefd5e2ecaf Try to fix xpcshell condprof permafailure on test_quota.js from test_deleteAllAtShutdown. r=saschanaz CLOSED TREE
Pushed by csabou@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/5c6f2b83b3e9 Fix prettier eslint failure on test_quota.js. a=lint-fix CLOSED TREE DONTBUILD
Regressions: 1804617
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: