Closed Bug 1991910 Opened 5 months ago Closed 1 month ago

toolkit/components/extensions/test/xpcshell/test_MatchPattern.js fails frequently in parallel

Categories

(WebExtensions :: General, defect, P3)

defect

Tracking

(firefox149 fixed)

RESOLVED FIXED
149 Branch
Tracking Status
firefox149 --- fixed

People

(Reporter: florian, Assigned: zombie, NeedInfo)

References

Details

(Whiteboard: [addons-jira])

Attachments

(1 file)

This happens about 20 times a day, and isn't visible on treeherder because the xcpshell tests failing in parallel then re-run a second time sequentially.

Here's a profile of a failure: https://share.firefox.dev/46x0A0P
The failure message was: [test_MatchGlob_redundant_wildcards_backtracking : 527] First matching duration: 402ms (limit: 20ms) - 402 < 20

This happened on a Mac machine that was running slowly (I suspect it of over heating).

https://searchfox.org/firefox-main/rev/21d3e8ab8b61715ddd39ac04c62a846fa79deddd/toolkit/components/extensions/test/xpcshell/test_MatchPattern.js#490-540 seems non-deterministic. Especially, it attempts to measure performance by measuring wall clock time. I think it could be more reliable if it measured CPU time instead (especially for tests that are running in parallel with 30 other tests running at the same time).

Here's some example code of how to measure CPU time from an xpcshell test:

// Get total CPU time for the current process and all its children
async function getTotalCpuTime() {
  let procInfo = await ChromeUtils.requestProcInfo();
  let totalCpuTime = procInfo.cpuTime;

  // Add CPU time from all child processes
  for (let child of procInfo.children) {
    totalCpuTime += child.cpuTime;
  }

  return totalCpuTime;
}

Calling it instead of Date.now() should provide something more deterministic.

See Also: → 1951522
Whiteboard: [addons-jira]
Assignee: nobody → tomica
Status: NEW → ASSIGNED
Severity: -- → S3
Priority: -- → P3
Severity: S3 → S4
Pushed by chorotan@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/3d3016fb3463 https://hg.mozilla.org/integration/autoland/rev/585b48d93122 Revert "Bug 1991910 - Use CPU time instead of wall clock in test_MatchPattern.js r=robwu" for causing xpcshell failures on test_MatchPattern.js

Backed out for causing xpcshell failures on test_MatchPattern.js

Backout link

Push with failures

Failure log

Flags: needinfo?(tomica)
Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 149 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: