Closed Bug 1673026 Opened 4 years ago Closed 4 years ago

TaskController sequencing is not atomic

Categories

(Core :: Performance, defect, P1)

Firefox 82
defect

Tracking

()

RESOLVED FIXED
84 Branch
Tracking Status
firefox-esr78 --- unaffected
firefox81 --- wontfix
firefox82 --- wontfix
firefox83 --- fixed
firefox84 --- fixed

People

(Reporter: denispal, Assigned: denispal)

References

Details

Attachments

(1 file)

sCurrentTaskSeqNo in the TaskController is used to assign a sequence number to all tasks created. However, it is not currently updated atomically so it is possible for two threads to create a task with the same sequence number. This could lead to some tasks not being inserted into the task graph and dropped since mMainThreadTasks will think they are identical.

Severity: -- → S2
Priority: -- → P1
Pushed by dpalmeiro@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/6f4c8138d233 Change type of sCurrentTaskSeqNo to Atomic<uint64_t> r=bas
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 84 Branch

Comment on attachment 9183486 [details]
Change type of sCurrentTaskSeqNo to Atomic<uint64_t>

Beta/Release Uplift Approval Request

  • User impact if declined: Without this fix, some events that are dispatched to the main event queue may be dropped and never re-executed. This can lead to events such as key presses or navigations not doing anything, or weird behavior in other circumstances. Generally, repeating the task should probably work fine.
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): The change forces atomic access to one variable so that sequential consistency is forced. It should be safe.
  • String changes made/needed:
Attachment #9183486 - Flags: approval-mozilla-release?
Attachment #9183486 - Flags: approval-mozilla-beta?

Why should we uplift this to release? Is it a new bug? Did we see evidence of it happening in the wild?

Flags: needinfo?(dpalmeiro)

(In reply to Julien Cristau [:jcristau] from comment #5)

Why should we uplift this to release? Is it a new bug? Did we see evidence of it happening in the wild?

It's a bug we just discovered that could lead to events not being added properly to the event queue. This could have a very wide range of intermittent effects from missing keystrokes to broken websites. Since it heavily depends on a race condition to exist, it's likely rare to occur and hard to reproduce. Some situations like missing keystrokes have been reported recently, but it's too hard to tell if they are related.

Flags: needinfo?(dpalmeiro)

Looks like this code dates back to bug 1606706, in 80. I'd rather not uplift to release.

Attachment #9183486 - Flags: approval-mozilla-release? → approval-mozilla-release-

Comment on attachment 9183486 [details]
Change type of sCurrentTaskSeqNo to Atomic<uint64_t>

We are still in the early betas part of the 83 cycle, let's take it for 83.0b5 as it is a P1/S2, thanks

Attachment #9183486 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: