Closed Bug 920017 Opened 6 years ago Closed 6 years ago
Race condition in Background
File Saver when set Target is called multiple times in append mode
The Downloads API tests surfaced a race condition that may happen in BackgroundFileSaver. In append mode, the first call to setTarget should set the file to append to, and subsequent calls should allow it to be renamed. However, if setTarget is called rapidly for two times, the worker thread has no chance to notice the first call, and we end up appending to the wrong file.
Multithreading is hard, this code is complex, and regression tests are good. This patch fixes the completion condition, and a similar version passed try: https://tbpl.mozilla.org/?tree=Try&rev=ce27bf80cec1
Attachment #809752 - Flags: review?(mcmanus) → review+
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla27
Comment on attachment 809752 [details] [diff] [review] Fixed patch We might uplift this to Aurora to fix intermittent test failures. [Approval Request Comment] Bug caused by (feature/regressing bug #): 887425 User impact if declined: Virtually none, but fixes intermittent test failures. Testing completed (on m-c, etc.): m-c Risk to taking this patch (and alternatives if risky): Low, has tests String or IDL/UUID changes made by this patch: None
Attachment #809752 - Flags: approval-mozilla-aurora?
Attachment #809752 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
You need to log in before you can comment on or make changes to this bug.