Closed Bug 1370453 Opened 2 years ago Closed 2 years ago

Potential race condition in ThenCommand<>::Track()

Categories

(Core :: XPCOM, enhancement)

enhancement
Not set

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: jwwang, Assigned: jwwang)

Details

Attachments

(1 file)

http://searchfox.org/mozilla-central/rev/d441cb24482c2e5448accaf07379445059937080/xpcom/threads/MozPromise.h#953-958

MozPromiseRequestHolder is not thread-safe and it is possible for mReceiver->ThenInternal() to trigger resolve/reject callbacks before aRequestHolder.Track() is run.

We should call aRequestHolder.Track() before mReceiver->ThenInternal() to avoid the race condition.
Assignee: nobody → jwwang
Attachment #8875096 - Flags: review?(gsquelart)
Comment on attachment 8875096 [details]
Bug 1370453 - fix potential race condition in ThenCommand<>::Track().

https://reviewboard.mozilla.org/r/146478/#review150468
Attachment #8875096 - Flags: review?(gsquelart) → review+
Thanks!
Pushed by jwwang@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/4d5d122b04ea
fix potential race condition in ThenCommand<>::Track(). r=gerald
https://hg.mozilla.org/mozilla-central/rev/4d5d122b04ea
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.