Closed Bug 1303940 Opened 8 years ago Closed 8 years ago

MessageLoop::PostDelayedTask() schedules the runnable to the calling thread

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla52
Tracking Status
firefox49 --- wontfix
firefox50 --- fixed
firefox51 --- fixed
firefox52 --- fixed

People

(Reporter: cyu, Assigned: cyu)

References

Details

Attachments

(1 file)

Internally in MessageLoop::PostDelayedTask() a nsITimer is created to delay the execution, but it doesn't set the target thread. The timer then uses the calling thread as the target. This makes delayed tasks posted to another thread run on the wrong thread and may create races or assertion failures.
Attachment #8792769 - Flags: review?(nfroyd)
Summary: MessageLopo::PostDelayedTask() schedules the runnable to the calling thread → MessageLoop::PostDelayedTask() schedules the runnable to the calling thread
Comment on attachment 8792769 [details]
Bug 1303940 - MessageLoop::PostDelayedTask() should schedule the runnable on the target thread instead of the current thread.

https://reviewboard.mozilla.org/r/79672/#review78536

I'm surprised that nothing seems to have gone seriously wrong with a mistake like this, though maybe there are some intermittents and things that started cropping up related to this.
Attachment #8792769 - Flags: review?(nfroyd) → review+
Thank you for catching this!
Pushed by cyu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b3cc2b2d346c
MessageLoop::PostDelayedTask() should schedule the runnable on the target thread instead of the current thread. r=froydnj
https://hg.mozilla.org/mozilla-central/rev/b3cc2b2d346c
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
Comment on attachment 8792769 [details]
Bug 1303940 - MessageLoop::PostDelayedTask() should schedule the runnable on the target thread instead of the current thread.

Approval Request Comment
[Feature/regressing bug #]: 1269056
[User impact if declined]: Potential stability issues. This is a bug in the threading component in the lower layer, which makes some code scheduled on the wrong thread. Runtime aborts or race condition may result from this bug.
[Describe test coverage new/current, TreeHerder]: Patch just landed on m-c and passed auto regression tests.
[Risks and why]: Low. This patch is relatively simple and is unlikely to have other side effects.
Attachment #8792769 - Flags: approval-mozilla-beta?
Comment on attachment 8792769 [details]
Bug 1303940 - MessageLoop::PostDelayedTask() should schedule the runnable on the target thread instead of the current thread.

Approval Request Comment
[Feature/regressing bug #]: 1269056
[User impact if declined]: Potential stability issues. This is a bug in the threading component in the lower layer, which makes some code scheduled on the wrong thread. Runtime aborts or race condition may result from this bug.
[Describe test coverage new/current, TreeHerder]: Patch just landed on m-c and passed auto regression tests.
[Risks and why]: Low. This patch is relatively simple and is unlikely to have other side effects.
Attachment #8792769 - Flags: approval-mozilla-aurora?
This also affects 49. Should we ship this in the next point release?
(In reply to Cervantes Yu [:cyu] [:cervantes] from comment #8)
> This also affects 49. Should we ship this in the next point release?

You can nominate it for uplift to moz-release and let 49 release owner (Liz) decide but just looking at the patch and the fact that we haven't seen any real end-user feedback tied to this issue yet in Fx49, I'd say the likelihood of this going in a dot release is pretty low.
Comment on attachment 8792769 [details]
Bug 1303940 - MessageLoop::PostDelayedTask() should schedule the runnable on the target thread instead of the current thread.

Let's uplift this to Aurora51 today and stabilize over the weekend before uplifting to 50.0b2 next week.
Attachment #8792769 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Comment on attachment 8792769 [details]
Bug 1303940 - MessageLoop::PostDelayedTask() should schedule the runnable on the target thread instead of the current thread.

Fix has stabilized on Nightly and Aurora for a few days, Beta50+
Attachment #8792769 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Looks like this may have been a regression from 49. Unless we know it will improve stability in some particular case, I don't think fixing this on the release channel should be a priority.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: