Closed Bug 1620227 Opened 1 year ago Closed 1 year ago

Search service can install extensions after shutdown has started which makes things sad

Categories

(Firefox :: Search, defect, P1)

defect
Points:
2

Tracking

()

VERIFIED FIXED
Firefox 75
Iteration:
75.2 - Feb 24 - Mar 8
Tracking Status
firefox75 --- fixed

People

(Reporter: Gijs, Assigned: standard8)

References

Details

Attachments

(1 file)

I spotted some errors in a log that indicated that we're trying to installBuiltinAddon after the addon manager shuts down, which ends in tears because it throws errors.

https://searchfox.org/mozilla-central/rev/c79c0d65a183d9d38676855f455a5c6a7f7dadd3/toolkit/components/search/SearchService.jsm#1301

and

https://searchfox.org/mozilla-central/rev/c79c0d65a183d9d38676855f455a5c6a7f7dadd3/toolkit/components/search/SearchService.jsm#2544

(that one is the one this is hitting, AFAICT)

should probably catch exceptions, and/or we should bail out if Services.startup.isShuttingDown is true or AddonManager.isReady is false.

In both these cases we do actually have try/catches around these so the errors reported don't break init. We could add extra checks and avoid the console output, but I'm not completely sure that is worth it.

The concerning bit is that we'll still try to write the cache - we've seen it with reInit() (bug 1580737) that it could write a broken cache if we shutdown in the middle of reInit(). Broken here would be writing the cache but without the built-in search engines, which on next startup would mean that we think there's no built-in engines, and we wouldn't display them.

I missed the case here when fixing bug 1580737 that it could also apply to init(), so I think we should fix that. It may or may not help our cache problems that are tracked via bug 1589710.

Assignee: nobody → standard8
Blocks: 1589710
Iteration: --- → 76.1 - Mar 9 - Mar 22
Points: --- → 2
Priority: -- → P1
See Also: → 1580737

(In reply to Mark Banner (:standard8) from comment #1)

It may or may not help our cache problems that are tracked via bug 1589710.

Sounds really plausible to me, so yay for finding it, Gijs!!

I've just done a bit more testing. Hitting the "shutdown before init is finished" is quite easy. Hitting the add-on manager not started/shutting down case is quite difficult.

However, I still think it is worth the fix, and we have telemetry that is monitoring corruptions, so we should soon know if it helps or not.

Abort it before writing the cache to avoid potentially writing a incomplete cache.

Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a815e28f736a
Handle shutdown occurring during SearchService initialisation. r=mikedeboer
Iteration: 76.1 - Mar 9 - Mar 22 → 75.2 - Feb 24 - Mar 8
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 75

Hi Mark, is there something that QA can verify here? Thanks!

Flags: needinfo?(standard8)

You could try a few tests along the lines of:

  1. Set up a Firefox profile where some of the default engines are removed / re-ordered / with different settings (e.g. keyword).
  2. Shut down Firefox.
  3. Start Firefox and close it as soon as you see the 'x' (assuming Windows here).
  4. Start Firefox again and check that the engines are still with the same settings.
  5. Repeat steps 3-4 varying the time after the window appears (you only need to go up to a max of a few seconds).

I'm not sure you'll be able to do a before / after comparison, this bug is highly timing dependent. However, just doing some tests along the lines of the above would be useful to reassure us it hasn't got worse.

Flags: needinfo?(standard8)

Thank you Mark!

Flags: qe-verify+

Hello,

I tried to reproduce this issue with Fx 75.0a1 (BuildID: 20200305095541) and i could not get the timing down to reproduce this issue, on the plus side I could not reproduce with the current beta 75.0b10 either. I closed firefox 0.7 sec after the x button appeared and when I opened the browser again all the changes made were still there, I did this a couple of times and the settings were always saved.

I think it's safe to remove the qe+ flag for this bug based on comm 8.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.