Closed
Bug 1019408
Opened 10 years ago
Closed 10 years ago
Provide facility to prevent starting during migration
Categories
(Firefox :: Sync, defect)
Firefox
Sync
Tracking
()
People
(Reporter: markh, Assigned: markh, Mentored)
References
Details
(Whiteboard: [diamond][lang=js])
Attachments
(1 file, 1 obsolete file)
8.73 KB,
patch
|
rnewman
:
review+
|
Details | Diff | Splinter Review |
As part of the sync migration, we will need to "reset" the legacy sync (ie, call service.startOver()) before re-configuring it for the FxA account. We will want to ensure Sync isn't running when we take this step - so we need to wait for the sync to complete. The fly in the ointment is the risk that sync doesn't complete for some users (eg, bug 1006360 and others) - so if sync has started once in the current session, this wait will be futile. One option here would be that when we get to the migration step where we need to wait for a sync, we should ensure (via prefs?) that sync is effectively disabled. Then the scenario for these users would be that the migration can complete the next time Firefox is started - disabling sync means that this new startup will not sync before we've had the opportunity to complete the migration. (Yes, these users will still almost be certainly be left with a sync that still never completes, but at least it will be an FxA based sync)
Flags: firefox-backlog+
Updated•10 years ago
|
Whiteboard: p=5 → p=5 [qa+]
Comment 1•10 years ago
|
||
You can test if a sync is running: look at the service lock, or listen to start notifications. (TPS actually does something similar: watch for start and finish via observers.) You should also trivially be able to determine when it started -- record a timestamp at start. If start is way before finish, you can determine hang. You might consider extending the "App. quitting" check in the spinning code to allow for interruption.
Comment 2•10 years ago
|
||
Flagging as diamond - Markh, would you be willing to mentor this bug?
Flags: needinfo?(mhammond)
Whiteboard: p=5 [qa+] → p=5 [qa+][diamond]
Assignee | ||
Comment 3•10 years ago
|
||
(In reply to Mike Hoye [:mhoye] from comment #2) > Flagging as diamond - Markh, would you be willing to mentor this bug? I'm away for 8 weeks starting next Friday, and I expect we will want this bug worked on over that time, so that probably means I can't in practice.
Flags: needinfo?(mhammond)
Comment 4•10 years ago
|
||
Thanks; Richard, how about you? Mentoring! Fame(*) and fortune(*)! (*) - Mentoring is not guaranteed to result in fame or fortune.
Flags: needinfo?(rnewman)
Comment 5•10 years ago
|
||
I can make a little time, albeit probably not the attention I would like to lavish on a contributor!
Flags: needinfo?(rnewman)
Whiteboard: p=5 [qa+][diamond] → p=5 [qa+][diamond][mentor=rnewman][lang=js]
Updated•10 years ago
|
Mentor: rnewman
Whiteboard: p=5 [qa+][diamond][mentor=rnewman][lang=js] → p=5 [qa+][diamond][lang=js]
Assignee | ||
Updated•10 years ago
|
Mentor: mhammond
Updated•10 years ago
|
Points: --- → 5
Flags: qe-verify+
Whiteboard: p=5 [qa+][diamond][lang=js] → [diamond][lang=js]
Assignee | ||
Updated•10 years ago
|
No longer blocks: migratesync
Updated•10 years ago
|
Assignee: nobody → mhammond
Status: NEW → ASSIGNED
Iteration: --- → 36.2
Assignee | ||
Updated•10 years ago
|
Summary: Provide facility to wait for sync to complete and stop it starting again during migration → Provide facility to prevent starting during migration
Assignee | ||
Comment 6•10 years ago
|
||
As mentioned above, I think it's important to be able to prevent sync starting just in-case the user is one of the few for which sync never stops. Such users would need to complete a migration within the first 10 seconds of the browser starting to ever complete. This patch adds 2 new methods - blockSync() and unblockSync(). blockSync() takes a param to indicate how long to block for, although this will only be used by tests. The default is to block for 2 days. This is a safety valve incase we end up calling .blockSync() and never arrange to call unblockSync() - eg, if the user migrates to the point where we call .blockSync(), then fecal matter hits the fan such that the migration never gets to the point of unblocking. In this case sync will magically restart (presumably with the legacy provider) after a couple of days.
Attachment #8519714 -
Flags: feedback?(rnewman)
Comment 7•10 years ago
|
||
Comment on attachment 8519714 [details] [diff] [review] 0003-Bug-1019408-add-facility-to-block-and-unblock-new-sy.patch Review of attachment 8519714 [details] [diff] [review]: ----------------------------------------------------------------- So... this looks fine, but is there a reason you didn't just specify a backoff, and use the existing backoff machinery? Something like Status.backoffInterval = interval; Status.minimumNextSync = Date.now() + interval; ::: services/sync/modules/policies.js @@ +509,5 @@ > + * that it will automatically unblock. This ensures that if things go > + * really pear-shaped and we never end up calling unblockSync() we haven't > + * completely broken the world. > + */ > + blockSync: function(until = null) { Just function (until) { should do the trick. Omit the argument, and it'll default to undefined. @@ +511,5 @@ > + * completely broken the world. > + */ > + blockSync: function(until = null) { > + if (!until) { > + until = Date.now() + DEFAULT_BLOCK_PERIOD; This is slightly worrying thanks to clock drift, but we don't have too many options. @@ +514,5 @@ > + if (!until) { > + until = Date.now() + DEFAULT_BLOCK_PERIOD; > + } > + // until is specified in ms, but Prefs can't hold that much > + Svc.Prefs.set("scheduler.blocked-until", Math.floor(until / 1000)); If you want to be really safe, you should flush prefs here. Services.prefs.savePrefFile(null); Otherwise a crash or force quit during migration might not have set the pref. That might be desirable; your call.
Attachment #8519714 -
Flags: feedback?(rnewman) → feedback+
Assignee | ||
Comment 8•10 years ago
|
||
(In reply to Richard Newman [:rnewman] from comment #7) > So... this looks fine, but is there a reason you didn't just specify a > backoff, and use the existing backoff machinery? Mainly as these aren't persisted over browser restarts IIUC.
Comment 9•10 years ago
|
||
Did you consider making the existing backoff mechanism persistent? (Not a dig; just want to make sure we're not adding a parallel mechanism when one isn't needed.)
Updated•10 years ago
|
Iteration: 36.2 → 36.3
Assignee | ||
Comment 10•10 years ago
|
||
(In reply to Richard Newman [:rnewman] from comment #9) > Did you consider making the existing backoff mechanism persistent? The problem as I see it is: * A sync is in progress * We request sync to be blocked. * During that sync we get a backoff header (which will typically be a number of minutes), so re-adjust the backoff to the lesser value. * User is one for which sync never stops - so eventually they exit their browser * User restarts, and the interval in the backoff header has expires, so sync restarts. I guess we could mitigate this by changing the backoff logic such that Status.backoffInterval = max(Status.backoffInterval, newInterval), but that kind of change scares me a little. Further, the fact that the current backoff interval isn't persisted has never been seen as a problem in the past - if we make this change, it will probably live forever, even though this migration requirement is relatively short-term - and for the vast majority of users, we expect the block() and unblock() to be within the same session, so nothing will actually be persisted (ie, the pref will be added and removed before shutdown) So on balance, I see reusing the backoff mechanism as riskier - what do you think?
Flags: needinfo?(rnewman)
Assignee | ||
Comment 12•10 years ago
|
||
Comment on attachment 8519714 [details] [diff] [review] 0003-Bug-1019408-add-facility-to-block-and-unblock-new-sy.patch (In reply to Richard Newman [:rnewman] from comment #11) > I'm happy with that analysis. Great :)
Attachment #8519714 -
Flags: review?(rnewman)
Updated•10 years ago
|
Iteration: 36.3 → 37.1
Assignee | ||
Comment 13•10 years ago
|
||
This now removes the ability for the migration module to function without this patch.
Attachment #8519714 -
Attachment is obsolete: true
Attachment #8519714 -
Flags: review?(rnewman)
Attachment #8532308 -
Flags: review?(rnewman)
Updated•10 years ago
|
Attachment #8532308 -
Flags: review?(rnewman) → review+
Updated•10 years ago
|
Iteration: 37.1 → 37.2
Assignee | ||
Comment 14•10 years ago
|
||
https://hg.mozilla.org/integration/fx-team/rev/a9d870df6db2
Comment 15•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/a9d870df6db2
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
Updated•10 years ago
|
QA Contact: twalker
Updated•9 years ago
|
Flags: qe-verify+
Updated•6 years ago
|
Component: Firefox Sync: Backend → Sync
Product: Cloud Services → Firefox
You need to log in
before you can comment on or make changes to this bug.
Description
•