Updating if an origin is accessed on the in-memory object is not guaranteed to be done before shutting down storage
Categories
(Core :: Storage: Quota Manager, defect, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox89 | --- | fixed |
People
(Reporter: tt, Assigned: tt)
References
Details
Attachments
(1 file)
I found this while running originInit.js
with my patches in the verify mode (more accurately in the chaos mode).
The test cases basically create a normal cache origin and then check files in the testing cache directory.
In short, the steps roughly are:
- Running a script with some normal cache operations.
- Resetting.
- Checking files.
- Initializing.
- Checking files again.
In step 4, I expected that the testing origin should be initialized (In other words, InitOrigin
should be called).
However, actually, in some extreme cases, that InitOrigin
wasn't called and thus some test cases fail because of that.
After looking into it, I think what happened was:
a. In step 1, on the Background thread, Cache registers a directory lock.
b. In step 2, on the Background thread, the Reset operation registers a directory lock and it waits for the blocking lock in step 1 to be released.
c. In steps 2, after the lock is destructed, on the IO thread, the Reset operation shuts down the storage and then writes whether the origin is accessed into database.
d. In steps 2, on the Background thread, the access time and if the origin has been accessed are updated when unregistering the directory lock.
e. In step 4, on the Background thread, it only initializes the origins that are marked as accessed.
In general case, the sequence is like: a->b->d>c->e.
However, it's possible to be like: a->b->c->d->e. It's possible that the origin isn't marked as accessed on the Background thread before shutting down the storage on the IO thread.
For the fix, I think we should unregister the lock before unlocks other blocked locks. So that whether an origin is accessed is updated before updating the SQL statement.
Assignee | ||
Comment 1•3 years ago
|
||
Depends on D109639
Updated•3 years ago
|
Assignee | ||
Comment 2•3 years ago
|
||
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Assignee | ||
Comment 3•3 years ago
|
||
Pushed by shes050117@gmail.com: https://hg.mozilla.org/integration/autoland/rev/10f3e7d643a7 Unregister the lock itself before unblock other locks; r=dom-storage-reviewers,sg,janv
Comment 5•3 years ago
|
||
bugherder |
Description
•