Closed Bug 903093 Opened 7 years ago Closed 7 years ago
Ensure that XPI and Addon
Repository JSON is completely written before shutdown
The AddonRepository and XPIDatabase conversion to JSON added asynchronous writes of the databases, which could happen at shutdown time. I'm not sure how strongly we can guarantee that the write has completed before shutdown; we may need to add something (either a nested event loop or a hook in the main event loop) to wait for these writes to complete. The async writes may start during profile-before-change, and it's possible for there to be a second write. The worst case scenario is: First write starts Data is modified again profile-before-change notification comes Flush JSON; queues a promise to start a second write after the first write completes profile-before-change done First write completes Second write begins The more common (but still rare) cases would be for a single write to be in progress when profile-before-change comes, or for a single write to be triggered by profile-before-change. My understanding, and Yoric should correct me here if necessary, is that when OS.File shuts down (during xpcom-shutdown) it blocks until all in progress writes have finished. This would mean we're safe in every case *except* my worst case scenario above, if what happens is: Write starts Data is modified again profile-before-change set up delayed second write profile-before-change ends xpcom-shutdown starts OS.File blocks until first in-progress write completes xpcom-shutdown ends Second write is attempted, but fails because OS.File is gone
Work on this is being done in bug 911621.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 911621
You need to log in before you can comment on or make changes to this bug.