Closed Bug 1525729 Opened 5 years ago Closed 5 years ago

AsyncShutdown timeout in asyncEmitManifestEntry("chrome_settings_overrides")


(WebExtensions :: General, defect, P1)

63 Branch


(firefox-esr60 unaffected, firefox65 wontfix, firefox66 wontfix, firefox67 fixed)

Tracking Status
firefox-esr60 --- unaffected
firefox65 --- wontfix
firefox66 --- wontfix
firefox67 --- fixed


(Reporter: philipp, Assigned: robwu)


(Blocks 1 open bug)


(Keywords: crash, regression)

Crash Data


(2 files)

+++ This bug was initially created as a clone of Bug #1493770 +++

This bug is for crash report bp-732d9200-05ae-4068-a66f-91cf50190206.



            "name":"Extension shutdown:",
                "state":"Startup: Run manifest: asyncEmitManifestEntry("chrome_settings_overrides")"


these particular async shutdown timeout crashes started showing up since firefox 63 with webextensions adding a custom search provider.

bug 1493770 already took a stab at fixing those crashes, but that didn't make the crash volume noticeably decline in firefox 65, so i'm filing this as a followup.

this crash-stats query should catch the remaining issues:

Priority: -- → P1

TL;DR The crash is caused by await searchInitialized; at

The onManifestEntry handler of ext-chrome-settings-overrides.js has several await calls, each of which could be responsible for this crash. I'm only looking at await because these block the promise. I'm not considering synchronous API calls because it's unlikely for those to block the promise for a minute.

I fetched all add-ons that were reported in the 1630 crash reports from this year until yesterday, and checked the content of the extensions' chrome_settings_override.

There are some crashes where the responsible add-on does not have chrome_settings_override.search_provider.is_default. This allows us to eliminate the majority of await uses, leaving only three potential causes of the hang:

From the reports, 2 of the add-ons involved in a crash have only set a homepage_url. This rules out the first option (because then we should have seen significantly more crashes from add-ons that had only set chrome_settings_override.homepage, and we should also also have seen a similar volume of crashes for addons that use chrome_url_overrides, because it also uses similar code).

addSearchEngine currently has many awaits, but most of these were recently added. The crashes already happened before that, so that leaves the only cause in addSearchEngine to be await ExtensionSettingsStore.addSetting (

ExtensionSettingsStore.addSetting is also used by ext-url-overrides.js, for we have only 23 crash reports in the same time frame as the this bug (87 crash reports in the past six months) (reports with asyncEmitManifestEntry(\"chrome_url_overrides\")).
If ExtensionSettingsStore.addSetting were to be the cause of this bug, then the crash rates for chrome_url_overrides should also have been higher.

This leaves us with one possible cause for this crash, await searchInitialized;, which is defined at

The searchInitialized promise is only fulfilled when the "browser-search-service" notification has been triggered. Coincidentally, the defaultSearchEngine / defaultSearchEngineData fields in the telemetry environment are only set up once the notification has been triggered.
These fields are missing from the telemetry environment in the crash reports of this bug, which offers conclusive evidence that this crash is caused by the await searchInitialized;.

Blocks: 1352598
Assignee: nobody → rob
Attachment #9043708 - Attachment description: Bug 1525729 - Reject searchInitialized promise on shutdown → Bug 1525729 - Ignore searchInitialized promise on shutdown
Pushed by
Ignore searchInitialized promise on shutdown r=aswan
Attachment #9043708 - Attachment description: Bug 1525729 - Ignore searchInitialized promise on shutdown → Bug 1525729 - Stop blocking extension startup on searchInitialized
Flags: needinfo?(rob)
Depends on: 1534969

When I added AddonTestUtils.initMochiTest to an existing test at
, the test started to fail often on debug builds, with errors like
"leaked 2 window(s) until shutdown".
Fix this by clearing the global that was saved by initMochiTest.

I'm landing the patch from comment 5 first, because the other patch is part of a patch stack that has to land after comment 5's patch to avoid test failures.

Keywords: leave-open
Pushed by
Avoid memory leak via AddonTestUtils.initMochiTest r=aswan

Now going to land the other stack.
Green try:
The commits of the patch stack aren't visible in the try push because they were part of a preview push (whose failures have been addressed in the above try push):

Keywords: leave-open
Pushed by
Stop blocking extension startup on searchInitialized r=aswan
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla67

Can you please provide us an extension that we can use to test this manually (and some steps to reproduce the crash would be much apreciated)?

Flags: needinfo?(rob)
You need to log in before you can comment on or make changes to this bug.