Closed Bug 1803771 Opened 3 years ago Closed 3 years ago

Intermittent toolkit/components/extensions/test/browser/browser_ext_eventpage_disableResetIdleForTest.js | single tracking bug

Categories

(WebExtensions :: General, defect, P5)

defect

Tracking

(firefox109 fixed)

RESOLVED FIXED
109 Branch
Tracking Status
firefox109 --- fixed

People

(Reporter: intermittent-bug-filer, Assigned: rpl)

Details

(Keywords: intermittent-failure, intermittent-testcase, Whiteboard: [retriggered])

Attachments

(1 file)

Filed by: ncsoregi [at] mozilla.com
Parsed log: https://treeherder.mozilla.org/logviewer?job_id=398454228&repo=autoland
Full log: https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/QxzEbJaDQxKjDDrCGs5jyA/runs/0/artifacts/public/logs/live_backing.log


[task 2022-12-02T12:54:43.874Z] 12:54:43     INFO - TEST-PASS | toolkit/components/extensions/test/browser/browser_ext_eventpage_disableResetIdleForTest.js | browserAction.onClicked listener expected to be primed - {"pendingEvents":[],"unregister":"() => {\n          this.off(\"click\", listener);\n        }","convert":"convert(newFire, extContext) {\n          fire = newFire;\n          context = extContext;\n        }"} == true - 
[task 2022-12-02T12:54:43.874Z] 12:54:43     INFO - Leaving test bound test_disableResetIdleForTest_true
[task 2022-12-02T12:54:43.875Z] 12:54:43     INFO - Buffered messages finished
[task 2022-12-02T12:54:43.876Z] 12:54:43     INFO - TEST-UNEXPECTED-FAIL | toolkit/components/extensions/test/browser/browser_ext_eventpage_disableResetIdleForTest.js | Unable to find a rejection expected by expectUncaughtRejection. - 1 == 0 - JS frame :: resource://testing-common/PromiseTestUtils.sys.mjs :: assertNoMoreExpectedRejections :: line 284
[task 2022-12-02T12:54:43.876Z] 12:54:43     INFO - Stack trace:
[task 2022-12-02T12:54:43.876Z] 12:54:43     INFO - resource://testing-common/PromiseTestUtils.sys.mjs:assertNoMoreExpectedRejections:284
[task 2022-12-02T12:54:43.877Z] 12:54:43     INFO - chrome://mochikit/content/browser-test.js:nextTest:676
[task 2022-12-02T12:54:43.878Z] 12:54:43     INFO - GECKO(4199) | JavaScript error: , line 0: AbortError: Actor 'Conduits' destroyed before query 'RunListener' was resolved
[task 2022-12-02T12:54:43.878Z] 12:54:43     INFO - Console message: [JavaScript Error: "AbortError: Actor 'Conduits' destroyed before query 'RunListener' was resolved"]
[task 2022-12-02T12:54:43.929Z] 12:54:43     INFO - GECKO(4199) | MEMORY STAT | vsize 11736MB | residentFast 498MB | heapAllocated 275MB
[task 2022-12-02T12:54:43.929Z] 12:54:43     INFO - TEST-OK | toolkit/components/extensions/test/browser/browser_ext_eventpage_disableResetIdleForTest.js | took 577ms

Hi Luca! Can you please take a look at this? The backfill range and retriggers show that this is regressed by your recent changes in Bug 1745763.
Thank you!

Flags: needinfo?(lgreco)
Whiteboard: [retriggered]

This test was using PromiseTestUtils.expectUncaughtRejection to ignore the error "Actor 'Conduits' destroyed before ..."
triggered as a side-effect when the idle test page is being terminated while some API event listeners may have not
been removed and Gecko may still be in the process of trying to call the event listener in the child process, while the
listener was kept active by a setTimeout and a Promise tied to it.

I suspect that the intermittent failure may be due to the setTimeout which may be intermittently able to have freed the listener,
and in that case the error being asserted using expectUncaughtRejection may not be actually be rejected.

To make sure this test behavior isn't going to be too tied to the race between setTimeout and the test being able to call
extension.terminateBackground, this patch is:

  • replacing the the Promise + setTimeout used to keep the listener with a "never resolved" Promise, which would never be resolved
    and so it should not be subjected to a race.

  • replacing the PromiseTestUtils.expectUncaughtRejection call inside the single test with a
    PromiseTestUtils.allowMatchingRejectionsGlobally called for the entire test file, because
    in the end the Conduits JS Actors rejection are more of a side-effect and the test is explicitly asserting
    the behaviors directly expected (in particular the listeners being primed or not as expected), and it is also
    how to properly ignore errors that are too tight to potential races (e.g. between when we are triggering the
    browserAction onClicked and when the call to the listeners is about to be send across ipc to the extensions
    child process).

Assignee: nobody → lgreco
Status: NEW → ASSIGNED

I'm not 100% convinced that Bug 1745763 is actually what have introduced intermittency in this particular test, in particular it seems that the new test file landed only a couple of days before Bug 1745763 and in the retriggers it seems that with the changes from Bug 1745763 included it did only fail once over 15 job runs.

And so there is actually a chance that the failure would have had a low enough intermittency rate even without Bug 1745763 changes (or that Bug 1745763 may have chanced slightly some timing enough for the test to be more likely to trigger a pre-existing intermittency issue).

Anyway, I looked to the test case and even if I was not able to trigger the same intermittent failure locally, there are a couple of details in the test that looked a possible source of intermittent failures and so in comment 3 I'm attached a patch with some proposed tweaks meant to take care of that.

Flags: needinfo?(lgreco)
Pushed by mlaza@mozilla.com: https://hg.mozilla.org/mozilla-central/rev/cd04453b7a9c Prevent browser_ext_eventpage_disableResetIdleForTest.js intermittent failures. r=mixedpuppy
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 109 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: