Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2157)

Unified Diff: chrome/browser/sync/profile_sync_service.cc

Issue 62423002: Fix one case that can make sync backend stuck in auth error state. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/profile_sync_service.cc
diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc
index ead0cf5aed34d91b3096d36b6c71d9d71e23f849..f744238547aa48018bf1e795a1e9f6ff123f751e 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -643,8 +643,6 @@ void ProfileSyncService::OnGetTokenSuccess(
const base::Time& expiration_time) {
DCHECK_EQ(access_token_request_, request);
access_token_request_.reset();
- // Reset backoff time after successful response.
- request_access_token_backoff_.Reset();
access_token_ = access_token;
if (backend_)
backend_->UpdateCredentials(GetCredentials());
@@ -1111,9 +1109,25 @@ void ProfileSyncService::OnConnectionStatusChange(
// Sync server returned error indicating that access token is invalid. It
// could be either expired or access is revoked. Let's request another
// access token and if access is revoked then request for token will fail
- // with corresponding error.
- RequestAccessToken();
+ // with corresponding error. If access token is repeatedly reported
+ // invalid, there may be some issues with token server. In that case, we
tim (not reviewing) 2013/11/06 19:35:32 In fact, if the access token is repeatedly reporte
haitaol1 2013/11/06 22:37:30 I think the root cause is still on server. If serv
tim (not reviewing) 2013/11/07 22:07:13 But there could be *no issue* with the *token* ser
haitaol1 2013/11/08 15:23:02 Removed token On 2013/11/07 22:07:13, timsteele w
+ // backoff token requests exponentially to avoid hammering token server
+ // too much.
+ if (request_access_token_backoff_.failure_count() == 0) {
+ RequestAccessToken();
+ } else {
+ request_access_token_backoff_.InformOfRequest(false);
+ request_access_token_retry_timer_.Start(
+ FROM_HERE,
+ request_access_token_backoff_.GetTimeUntilRelease(),
+ base::Bind(&ProfileSyncService::RequestAccessToken,
+ weak_factory_.GetWeakPtr()));
+ }
} else {
+ // Reset backoff time after successful connection.
tim (not reviewing) 2013/11/06 19:35:32 This is where it gets dangerous and bug prone in m
haitaol1 2013/11/06 22:37:30 Good point. Changed to only reset if no request is
+ if (status == syncer::CONNECTION_OK)
+ request_access_token_backoff_.Reset();
+
const GoogleServiceAuthError auth_error =
ConnectionStatusToAuthError(status);
DVLOG(1) << "Connection status change: " << auth_error.ToString();
« no previous file with comments | « no previous file | sync/engine/net/server_connection_manager.cc » ('j') | sync/engine/net/server_connection_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698