Closed Bug 1624235 Opened 4 years ago Closed 4 years ago

Intermittent toolkit/components/extensions/test/xpcshell/test_ext_startup_cache.js | - A promise chain failed to handle a rejection: Unable to arm timer, the object has been finalized. - stack: arm@resource://gre/modules/DeferredTask.jsm:215:13

Categories

(WebExtensions :: General, defect, P1)

defect

Tracking

(firefox77 fixed)

RESOLVED FIXED
mozilla77
Tracking Status
firefox77 --- fixed

People

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

References

(Regression)

Details

(Keywords: intermittent-failure, regression, test-disabled, Whiteboard: webext?)

Attachments

(1 file)

Filed by: aciure [at] mozilla.com
Parsed log: https://treeherder.mozilla.org/logviewer.html#?job_id=294274338&repo=mozilla-central
Full log: https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/Sm-v34BjQrK0rOSiKc0VOQ/runs/0/artifacts/public/logs/live_backing.log


[task 2020-03-22T22:25:14.886Z] 22:25:14 INFO - TEST-PASS | xpcshell-remote.ini:toolkit/components/extensions/test/xpcshell/test_ext_startup_cache.js | - Got expected manifest name - "en-US 1.1" == "en-US 1.1"
[task 2020-03-22T22:25:14.886Z] 22:25:14 INFO - (xpcshell/head.js) | test run_next_test 2 pending (2)
[task 2020-03-22T22:25:14.886Z] 22:25:14 INFO - (xpcshell/head.js) | test finished (2)
[task 2020-03-22T22:25:14.886Z] 22:25:14 INFO - (xpcshell/head.js) | test run_next_test 2 finished (1)
[task 2020-03-22T22:25:14.886Z] 22:25:14 INFO - exiting test
[task 2020-03-22T22:25:14.887Z] 22:25:14 WARNING - TEST-UNEXPECTED-FAIL | xpcshell-remote.ini:toolkit/components/extensions/test/xpcshell/test_ext_startup_cache.js | - A promise chain failed to handle a rejection: Unable to arm timer, the object has been finalized. - stack: arm@resource://gre/modules/DeferredTask.jsm:215:13
[task 2020-03-22T22:25:14.887Z] 22:25:14 INFO - saveSoon@resource://gre/modules/JSONFile.jsm:307:24
[task 2020-03-22T22:25:14.887Z] 22:25:14 INFO - save@resource://gre/modules/addons/XPIProvider.jsm:1603:20
[task 2020-03-22T22:25:14.887Z] 22:25:14 INFO - setStartupData@resource://gre/modules/addons/XPIProvider.jsm:3039:15
[task 2020-03-22T22:25:14.887Z] 22:25:14 INFO - saveStartupData@resource://gre/modules/Extension.jsm:2007:17
[task 2020-03-22T22:25:14.887Z] 22:25:14 INFO - _writePersistentListeners@resource://gre/modules/ExtensionCommon.jsm:2271:15
[task 2020-03-22T22:25:14.887Z] 22:25:14 INFO - savePersistentListener@resource://gre/modules/ExtensionCommon.jsm:2389:18
[task 2020-03-22T22:25:14.887Z] 22:25:14 INFO - addMessagingListener@chrome://extensions/content/parent/ext-runtime.js:196:42
[task 2020-03-22T22:25:14.887Z] 22:25:14 INFO - recvAPICall/result</<@resource://gre/modules/ExtensionParent.jsm:960:68
[task 2020-03-22T22:25:14.887Z] 22:25:14 INFO - withPendingBrowser@resource://gre/modules/ExtensionParent.jsm:592:26
[task 2020-03-22T22:25:14.887Z] 22:25:14 INFO - recvAPICall/result<@resource://gre/modules/ExtensionParent.jsm:960:24
[task 2020-03-22T22:25:14.887Z] 22:25:14 INFO - callAndLog@resource://gre/modules/ExtensionParent.jsm:922:14
[task 2020-03-22T22:25:14.887Z] 22:25:14 INFO - recvAPICall@resource://gre/modules/ExtensionParent.jsm:959:25
[task 2020-03-22T22:25:14.887Z] 22:25:14 INFO - Async*_recv@resource://gre/modules/ConduitsChild.jsm:78:20
[task 2020-03-22T22:25:14.887Z] 22:25:14 INFO - receiveMessage@resource://gre/modules/ConduitsParent.jsm:333:20
[task 2020-03-22T22:25:14.887Z] 22:25:14 INFO - _do_main@Z:\task_1584914388\build\tests\xpcshell\head.js:246:6
[task 2020-03-22T22:25:14.887Z] 22:25:14 INFO - _execute_test@Z:\task_1584914388\build\tests\xpcshell\head.js:573:5
[task 2020-03-22T22:25:14.887Z] 22:25:14 INFO - @-e:1:1
[task 2020-03-22T22:25:14.887Z] 22:25:14 INFO - Rejection date: Sun Mar 22 2020 22:25:14 GMT+0000 (Greenwich Mean Time) - false == true
[task 2020-03-22T22:25:14.888Z] 22:25:14 INFO - resource://testing-common/PromiseTestUtils.jsm:assertNoUncaughtRejections:265
[task 2020-03-22T22:25:14.888Z] 22:25:14 INFO - Z:\task_1584914388\build\tests\xpcshell\head.js:_execute_test:574
[task 2020-03-22T22:25:14.888Z] 22:25:14 INFO - -e:null:1
[task 2020-03-22T22:25:14.888Z] 22:25:14 INFO - exiting test

Could these be caused by the changes on bug 1624267?
decoder could you, please take a look?

Flags: needinfo?(choller)

Given this happens on all platforms, I don't think it would be bug 1624267.

The traceback indicates that an event following the browser.test.onMessage call in the test file has somehow been delayed past the extension unload AND the addon manager shutdown. The JSONFile saver is finalized during the addon manager shutdown, and would produce the error only after that.

Given this is going through conduits, maybe Tom has an idea why (or whether) an event is somehow becoming very delayed.

Flags: needinfo?(choller) → needinfo?(tomica)

I've a perma-fail repro for this now.

Flags: needinfo?(tomica) → needinfo?(mixedpuppy)

the NativeMessenger constructor[1] making a call to the parent. that does a conduit.sendAPICall[2]. The test finishes, we shutdown the addonmanager, then the parent side receives that call and tries to persist the event listener[3]. The is easily reproducible running the in-process tests, and reproducible running remote test with --verify.

I have yet to figure out a solid fix for this. Some minor changes in the test make it less likely to happen, but doesn't fix it.

[1] https://searchfox.org/mozilla-central/rev/4e228dc5f594340d35da7453829ad9f3c3cb8b58/toolkit/components/extensions/ExtensionChild.jsm#266
[2] https://searchfox.org/mozilla-central/rev/4e228dc5f594340d35da7453829ad9f3c3cb8b58/toolkit/components/extensions/ExtensionChild.jsm#951
[3] https://searchfox.org/mozilla-central/rev/4e228dc5f594340d35da7453829ad9f3c3cb8b58/toolkit/components/extensions/parent/ext-runtime.js#196

I've disabled test_ext_startupData.js in bug 1628307 in order to get our tests running correctly again for in-process tests.

That test fails due to the NativeMessenger constructor change from bug 1316748, however, removing that api call there results in failures in test_ext_messaging_startup.js.

Tom, any thoughts on how to address this? Essentially that call results in the runtime namespace being loaded[1]. However, that load races with the test itself, and looses.

[1] https://searchfox.org/mozilla-central/rev/4e228dc5f594340d35da7453829ad9f3c3cb8b58/toolkit/components/extensions/ExtensionParent.jsm#958

Flags: needinfo?(mixedpuppy) → needinfo?(tomica)
Regressed by: 1316748
Has Regression Range: --- → yes
Keywords: regression
Whiteboard: webext?

BTW, simply adding an empty runtime.onConnect listener to the background script is enough to fix this test file, but I'd like a second opinion on whether this is going to be an ongoing issue in other tests as well, or if there is a way to fix the underlying issue.

The runtime.addMessagingListener is a bit of hack already, it doesn't actually setup persisted event listeners, but instead sets up [1] a way for ExtensionParent.jsm to wakeup the background page [2] when it gets a message:

https://searchfox.org/mozilla-central/rev/4e228dc5/toolkit/components/extensions/parent/ext-runtime.js#235
https://searchfox.org/mozilla-central/rev/4e228dc5/toolkit/components/extensions/ExtensionParent.jsm#296

I think we can just simplify this by removing addMessagingListener altogether and always setting up wakeupBackground (but not actually calling it until needed).

Assignee: nobody → tomica
Flags: needinfo?(tomica)
Priority: P5 → P1

Also, unconfuse two different meaning of the "startup" event.
Bonus, shut up some logspam during tests.

Attachment #9140625 - Attachment description: Bug 1624235 - Simplify handling of messaging persistent listeners → Bug 1624235 - Simplify handling of persistent listeners for runtime messaging
Pushed by tjovanovic@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7f4f1d605c69
Simplify handling of persistent listeners for runtime messaging r=robwu

Over the last 7 days there are 39 failures on this bug. These happen on: linux1804-64-tsan, macosx1014-64-shippable, windows10-64, windows10-64-shippable, windows7-32, windows7-32-shippable
here is the most recent failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=298904856&repo=autoland&lineNumber=2923

Flags: needinfo?(tomica)
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla77
Flags: needinfo?(tomica)
Blocks: 1609221
See Also: → 1851873
Duplicate of this bug: 1474727
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: