Closed Bug 1497960 Opened 6 years ago Closed 6 years ago

ProfileAge.jsm is a little racey

Categories

(Toolkit :: Telemetry, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
mozilla64
Tracking Status
firefox64 --- fixed

People

(Reporter: mossop, Assigned: mossop)

References

Details

Attachments

(2 files)

Because we create multiple instances for a given profile directory and because reading the times.json is asynchronous for each we can end up with various races. For example: let a = ProfileAge(); let b = ProfileAge(); a.created; b.recordProfileReset(); Timeline: * Instance A starts loading times.json. * Instance B starts loading times.json. * Instance A finishes loading times.json, created date is missing so starts scanning profile. * Instance B finishes loading times.json, sets reset time and starts writing times.json. * Instance B finishes writing times.json. * Instance A finishes scanning profile, sets creation time and starts writing times.json. * Instance A finishes writing times.json. Now times.json exists with the creation time but the reset time has been lost.
ProfileAge now returns a promise that resolves to an instance that has already loaded its times.json. This makes multiple attempts to update data in times.json safer.
Marking P1 for "it's being worked on" and so it turns up in our dashboard.
Priority: -- → P1
Pushed by dtownsend@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3edf43a3f1a4 Make ProfileAge return the same instances for the same profile directory and preload times.json to avoid data races. r=janerik
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla64
Commit pushed to master at https://github.com/mozilla/activity-stream https://github.com/mozilla/activity-stream/commit/92661f1b9b0d6577bd3cac00b6dcbed3c2284ca6 Port Bug 1497960: Make ProfileAge return the same instances for the same profile directory and preload times.json to avoid data races. r=janerik (#4500)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: