New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 736408 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Aug 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

Cache local sync state on start to prevent race conditions during initialization

Project Member Reported by pastarmovj@chromium.org, Jun 23 2017

Issue description

Currently the pref value can change if the policy is flipped while sync is initializing and cause undesirable effects or data loss.

 
Status: Assigned (was: Untriaged)
Status: Started (was: Assigned)
Sky, thinking more about this I think it is better to implement this like the SyncDisabled policy code. Read the value from the pref store when needed but also install an observer for value changes.

If the value changes no matter from what to what I think the least we can do is issue a StopImpl(CLEAR_DATA) to clear the internal sync state so that on the next run Sync can pick up a new source.

Optimally we can also issue a TryStart on the controller once the StopImpl command has finished. This way unless the user has explicitly suppressed it or the SyncDisabled policy is in effect sync will restart with the newly selected backend.

What do you think?
I am taking this back. For now this is not feasible because a lot of the initialization depends on the flag so resetting the sync service on the fly seems rather impossible without significant refactoring. 

I will implement the caching as discussed instead.
Project Member

Comment 4 by bugdroid1@chromium.org, Aug 1 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/a032fa6ac58821217a2515dd826c5d19aa4b50e0

commit a032fa6ac58821217a2515dd826c5d19aa4b50e0
Author: Julian Pastarmov <pastarmovj@chromium.org>
Date: Tue Aug 01 13:35:08 2017

[sync] Cache the value of kEnableLocalSyncBackend in SyncPrefs.

The value could change during startup when delivered through policy
but the backend can not be switched on the fly. So make sure the
first seen value is preserved.

BUG= 736408 

Change-Id: Ie608e9735b6009df3cd7070338412bd5b83376f4
Reviewed-on: https://chromium-review.googlesource.com/586688
Reviewed-by: Sky Malice <skym@chromium.org>
Commit-Queue: Julian Pastarmov <pastarmovj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#490970}
[modify] https://crrev.com/a032fa6ac58821217a2515dd826c5d19aa4b50e0/components/sync/base/sync_prefs.cc
[modify] https://crrev.com/a032fa6ac58821217a2515dd826c5d19aa4b50e0/components/sync/base/sync_prefs.h

Status: Fixed (was: Started)

Sign in to add a comment