Closed Bug 1455464 Opened 6 years ago Closed 4 years ago

Normandy.uninit() is async, but does not block shut down

Categories

(Firefox :: Normandy Client, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
Firefox 80
Tracking Status
firefox61 --- wontfix
firefox80 --- fixed

People

(Reporter: mythmon, Assigned: mythmon)

References

Details

Attachments

(1 file)

In bug 1440782, Gijs notices that Normandy shutdown process doesn't block Firefox's shutdown. This means that if Normandy takes a while, it could lose data. Not great.

To quote Gijs:

> I guess the correct thing to do would be to ensure we add a shutdown blocker
> (see https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/AsyncShutdown.jsm)
> that gets resolved when we've finished saving state.
Blocks: 1614681

https://bugzilla.mozilla.org/show_bug.cgi?id=1614681#c13 suggests we could drop the shutdown sync of the prefs, but not some of the other tasks.

There's actually a shutdown blocker in the CleanupManager, and everything else is synchronous, and the observer service notification removals are actually probably no-ops, tbh. So I don't think we need to do anything here besides removing the preference rollouts sync code...

(In reply to Michael Cooper [:mythmon] from bug 1614681 comment #11)

We have an incremental sync of these prefs as the related values change. The on-shutdown sync is a backup in case they get out of sync.

Can you elaborate on this? I don't see anything observing the prefs for changes, and the only caller of saveStartupPrefs is uninit, but maybe I'm misunderstanding what you mean?

It does seem like the preference experiment code registers its own saveStartupPrefs stuff via the cleanup manager, which has a shutdown blocker, but the preference rollout code doesn't, and uses a hardcoded call from Normandy.uninit. Perhaps the right fix is switching the rollout code to also use the cleanup manager and removing the direct call from Normandy.uninit ?

Flags: needinfo?(mcooper)

Can you elaborate on this? I don't see anything observing the prefs for changes, and the only caller of saveStartupPrefs is uninit, but maybe I'm misunderstanding what you mean?

When we start an experiment, we call saveStartupPrefs. For rollouts, we call saveStartupPrefs at the end of every Normandy session (this would could probably be a bit more effective).

It does seem like the preference experiment code registers its own saveStartupPrefs stuff via the cleanup manager, which has a shutdown blocker, but the preference rollout code doesn't, and uses a hardcoded call from Normandy.uninit. Perhaps the right fix is switching the rollout code to also use the cleanup manager and removing the direct call from Normandy.uninit ?

This seems like a good idea, yeah. It makes the preference actions more self-contained, which seems nice. I'll do this.

Assignee: nobody → mcooper
Flags: needinfo?(mcooper)

Hey, how are you getting on with this bug - did the plan from comment #3 / comment #4 not work out? Is there anything I can do to help? The intermittent in bug 1614681 seems to basically be caused by this issue, and has gone up in frequency for some reason...

Flags: needinfo?(mcooper)

Apologies for the delays. This just got delayed by other work.

Flags: needinfo?(mcooper)
Pushed by mcooper@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6c6d456eb406
Use Normandy's cleanup manager for Preference Rollouts r=Gijs
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 80
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: