Closed Bug 2079324 Opened 1 month ago Closed 1 month ago

scheduler.postTask() with a delay queues the task at an arbitrary priority

Categories

(Core :: DOM: Performance APIs, defect)

defect

Tracking

()

RESOLVED FIXED
160 Branch
Tracking Status
firefox-esr115 --- wontfix
firefox-esr153 --- wontfix
firefox157 --- wontfix
firefox158 --- wontfix
firefox159 --- wontfix
firefox160 --- fixed

People

(Reporter: jstutte, Assigned: jstutte)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 external file)

The constructor of DelayedWebTaskHandler takes an EventQueuePriority but never stores it, so mPriority is left uninitialized:

https://searchfox.org/firefox-main/rev/00aad09a820405643aebd693e60a3333ccf04544/dom/webscheduling/WebTaskScheduler.h#342

When the delay elapses, DelayedWebTaskHandler::Call passes that value to WebTaskScheduler::DispatchTask, so a delayed task's event loop runnable is queued at whatever priority the memory happens to hold rather than the one derived from its TaskPriority. This has been the case since the API was prototyped in bug 1734997.

It went unnoticed because the value is often 0, which currently means Idle, and the task still runs eventually. Bug 2066416 adds a priority below Idle, making 0 mean that one, and its assertion in TaskController::AddTask caught it in /scheduler/post-task-delay.any.html and /scheduler/task-controller-setPriority-delayed-task.any.html, which got the stack backed out.

The fix is to initialize mPriority from aPriority.

Keywords: regression
Regressed by: 1734997
See Also: 1734997 →

Set release status flags based on info from the regressing bug 1734997

:sefeng211, since you are the author of the regressor, bug 1734997, could you take a look?

For more information, please visit BugBot documentation.

I'll propose a patch.

DelayedWebTaskHandler took the priority to dispatch at but never stored it,
so a delayed postTask queued its runnable at whatever priority mPriority
happened to hold.

Assignee: nobody → jstutte
Status: NEW → ASSIGNED
Flags: needinfo?(sean)
Attachment #9655250 - Attachment description: Bug 2079324 - Store the priority of a delayed web task. r?smaug → Bug 2079324 - Compute the priority of a delayed web task when its timeout fires. r?smaug
Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 160 Branch

The patch landed in nightly and beta is affected.

:jstutte, please make an uplift decision for beta:

  • For beta, nominate the patch for beta uplift approval if the fix should be included in this release, or set status-firefox159 to wontfix if the fix can wait for the next release.

See Requesting an Uplift for documentation on how to request an uplift.

For more information, please visit BugBot documentation.

Flags: needinfo?(jstutte)
Flags: needinfo?(jstutte)
QA Whiteboard: [qa-triage-done-c161/b160]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: