New issue
Advanced search Search tips

Issue 728683 link

Starred by 1 user

Issue metadata

Status: Archived
Owner:
Closed: Jun 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 1
Type: Bug



Sign in to add a comment

ARC auth failure due to OAuth2LoginManager not storing RT properly

Project Member Reported by xiy...@chromium.org, Jun 1 2017

Issue description

OAuth2LoginManager could stuck in the processing and cause ARC auth times out waiting for the refresh token.

Typical log:
[1597:1597:0525/140257.517469:VERBOSE1:oauth2_login_manager.cc(143)] OnRefreshTokenAvailable
...
[1597:1597:0525/140353.045099:WARNING:arc_auth_context.cc(121)] Failed to wait for refresh token.

Sample feedback:
https://feedback.corp.google.com/product/208/neutron?lView=rd&lReport=61659796645

The log seems suggest that OAuth2LoginManager::OnRefreshTokenAvailable is called but profile does not yet have the primary account id set. One hypothesis is that there is a race in UserSessionManager that it kicks start OAuth2LoginManager before it calls SetAuthenticatedAccountInfo.
 
I am unable to figure out how the race could happen. Suspected connection type change code is actually protected. Calling it multiple times would not cause restore session start prematurely.

One strange thing found with the feedback log is that we should see "Setting first login prefs" in the log for a new user on the device. This line is not found in the feedback. 

This makes me think the problem might have a similar cause of issue 718734, where user profile is loaded from ProfileManager::GetLastUsedProfile and did not go through UserSessionManager. Hence the primary account id is not set in the user profile.
Cc: emaxx@chromium.org

Comment 3 by emaxx@chromium.org, Jun 1 2017

Re comment 1:
> This makes me think the problem might have a similar cause of issue 718734,
> where user profile is loaded from ProfileManager::GetLastUsedProfile and did
> not go through UserSessionManager.
Note though that the basic case when UserSessionManager is completely unaware of the session for given User should be caught by this change: commit f588c3bceb117e579068d1b4b3bb4153642d941d.
Or you think that here we're hitting the corner case when the profile was created too early, but still from UserSessionManager::StartSession(), like it was in issue 718734?
Unfortunately, it seems that the user session is created before the unknown code loads the profile. So the CHECK does not fire.

When it happens, ProfileManager::CreateProfileAsync will not invoke the callback with CREATE_STATUS_CREATED (since profile is already created), causing UserSessionManager::InitProfilePreferences being skipped. I seems able to repro it pretty consistently now with ChromeVox enabled.

I have a band-aid CL: https://codereview.chromium.org/2921653004/ 

Will dig more on which code causes the profile to be loaded. If we need the fix badly, we can land the band-aid first.
Found the code that loads a user profile w/o UserSessionManager.

See https://bugs.chromium.org/p/chromium/issues/detail?id=718734#c12
Project Member

Comment 6 by bugdroid1@chromium.org, Jun 12 2017

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

commit 41d32a3c1bd0153aa660378b3b2a2c59e25c5f31
Author: xiyuan <xiyuan@chromium.org>
Date: Mon Jun 12 20:06:13 2017

cros: Fix loading user profile w/o UserSessionManager

The fallback logic in GetActiveUserOrOffTheRecordProfileFromPath
should cover the case when the user profile loading has not started.
So that it does not creates/loads user profile accidentally without
going through UserSessionManager.

BUG= 728683 ,718734
TEST=ProfileManagerTest.UserProfileLoading

Review-Url: https://codereview.chromium.org/2918203002
Cr-Commit-Position: refs/heads/master@{#478735}

[modify] https://crrev.com/41d32a3c1bd0153aa660378b3b2a2c59e25c5f31/chrome/browser/chrome_browser_main.cc
[modify] https://crrev.com/41d32a3c1bd0153aa660378b3b2a2c59e25c5f31/chrome/browser/chromeos/accessibility/accessibility_manager_browsertest.cc
[modify] https://crrev.com/41d32a3c1bd0153aa660378b3b2a2c59e25c5f31/chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc
[modify] https://crrev.com/41d32a3c1bd0153aa660378b3b2a2c59e25c5f31/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc
[modify] https://crrev.com/41d32a3c1bd0153aa660378b3b2a2c59e25c5f31/chrome/browser/chromeos/file_manager/path_util_unittest.cc
[modify] https://crrev.com/41d32a3c1bd0153aa660378b3b2a2c59e25c5f31/chrome/browser/chromeos/login/crash_restore_browsertest.cc
[modify] https://crrev.com/41d32a3c1bd0153aa660378b3b2a2c59e25c5f31/chrome/browser/chromeos/login/session/user_session_manager.cc
[modify] https://crrev.com/41d32a3c1bd0153aa660378b3b2a2c59e25c5f31/chrome/browser/chromeos/login/users/user_manager_unittest.cc
[modify] https://crrev.com/41d32a3c1bd0153aa660378b3b2a2c59e25c5f31/chrome/browser/chromeos/profiles/profile_helper.cc
[modify] https://crrev.com/41d32a3c1bd0153aa660378b3b2a2c59e25c5f31/chrome/browser/chromeos/profiles/profile_helper.h
[modify] https://crrev.com/41d32a3c1bd0153aa660378b3b2a2c59e25c5f31/chrome/browser/chromeos/status/data_promo_notification_unittest.cc
[modify] https://crrev.com/41d32a3c1bd0153aa660378b3b2a2c59e25c5f31/chrome/browser/download/notification/download_notification_browsertest.cc
[modify] https://crrev.com/41d32a3c1bd0153aa660378b3b2a2c59e25c5f31/chrome/browser/extensions/api/braille_display_private/braille_display_private_apitest.cc
[modify] https://crrev.com/41d32a3c1bd0153aa660378b3b2a2c59e25c5f31/chrome/browser/profiles/profile_manager.cc
[modify] https://crrev.com/41d32a3c1bd0153aa660378b3b2a2c59e25c5f31/chrome/browser/profiles/profile_manager.h
[modify] https://crrev.com/41d32a3c1bd0153aa660378b3b2a2c59e25c5f31/chrome/browser/profiles/profile_manager_unittest.cc
[modify] https://crrev.com/41d32a3c1bd0153aa660378b3b2a2c59e25c5f31/chrome/browser/ui/ash/chrome_new_window_client_browsertest.cc

Comment 7 by xiy...@chromium.org, Jun 12 2017

Labels: Merge-Request-60
Project Member

Comment 8 by sheriffbot@chromium.org, Jun 13 2017

Labels: -Merge-Request-60 Hotlist-Merge-Review Merge-Review-60
This bug requires manual review: M60 has already been promoted to the beta branch, so this requires manual review
Please contact the milestone owner if you have questions.
Owners: amineer@(Android), cmasso@(iOS), josafat@(ChromeOS), bustamante@(Desktop)

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: -Merge-Review-60 Merge-Approved-60
Project Member

Comment 10 by bugdroid1@chromium.org, Jun 14 2017

Labels: -merge-approved-60 merge-merged-3112
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/9a79b8191b3ddf8e37b22fb8f063278c592c07d5

commit 9a79b8191b3ddf8e37b22fb8f063278c592c07d5
Author: Xiyuan Xia <xiyuan@chromium.org>
Date: Wed Jun 14 16:02:51 2017

Merge "cros: Fix loading user profile w/o UserSessionManager"

> The fallback logic in GetActiveUserOrOffTheRecordProfileFromPath
> should cover the case when the user profile loading has not started.
> So that it does not creates/loads user profile accidentally without
> going through UserSessionManager.
>
> BUG= 728683 ,718734
> TEST=ProfileManagerTest.UserProfileLoading
>
> Review-Url: https://codereview.chromium.org/2918203002
> Cr-Commit-Position: refs/heads/master@{#478735}
> (cherry picked from commit 41d32a3c1bd0153aa660378b3b2a2c59e25c5f31)

Review-Url: https://codereview.chromium.org/2938863002 .
Cr-Commit-Position: refs/branch-heads/3112@{#342}
Cr-Branched-From: b6460e24cf59f429d69de255538d0fc7a425ccf9-refs/heads/master@{#474897}

[modify] https://crrev.com/9a79b8191b3ddf8e37b22fb8f063278c592c07d5/chrome/browser/chrome_browser_main.cc
[modify] https://crrev.com/9a79b8191b3ddf8e37b22fb8f063278c592c07d5/chrome/browser/chromeos/accessibility/accessibility_manager_browsertest.cc
[modify] https://crrev.com/9a79b8191b3ddf8e37b22fb8f063278c592c07d5/chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc
[modify] https://crrev.com/9a79b8191b3ddf8e37b22fb8f063278c592c07d5/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc
[modify] https://crrev.com/9a79b8191b3ddf8e37b22fb8f063278c592c07d5/chrome/browser/chromeos/file_manager/path_util_unittest.cc
[modify] https://crrev.com/9a79b8191b3ddf8e37b22fb8f063278c592c07d5/chrome/browser/chromeos/login/crash_restore_browsertest.cc
[modify] https://crrev.com/9a79b8191b3ddf8e37b22fb8f063278c592c07d5/chrome/browser/chromeos/login/session/user_session_manager.cc
[modify] https://crrev.com/9a79b8191b3ddf8e37b22fb8f063278c592c07d5/chrome/browser/chromeos/login/users/user_manager_unittest.cc
[modify] https://crrev.com/9a79b8191b3ddf8e37b22fb8f063278c592c07d5/chrome/browser/chromeos/profiles/profile_helper.cc
[modify] https://crrev.com/9a79b8191b3ddf8e37b22fb8f063278c592c07d5/chrome/browser/chromeos/profiles/profile_helper.h
[modify] https://crrev.com/9a79b8191b3ddf8e37b22fb8f063278c592c07d5/chrome/browser/chromeos/status/data_promo_notification_unittest.cc
[modify] https://crrev.com/9a79b8191b3ddf8e37b22fb8f063278c592c07d5/chrome/browser/download/notification/download_notification_browsertest.cc
[modify] https://crrev.com/9a79b8191b3ddf8e37b22fb8f063278c592c07d5/chrome/browser/extensions/api/braille_display_private/braille_display_private_apitest.cc
[modify] https://crrev.com/9a79b8191b3ddf8e37b22fb8f063278c592c07d5/chrome/browser/profiles/profile_manager.cc
[modify] https://crrev.com/9a79b8191b3ddf8e37b22fb8f063278c592c07d5/chrome/browser/profiles/profile_manager.h
[modify] https://crrev.com/9a79b8191b3ddf8e37b22fb8f063278c592c07d5/chrome/browser/profiles/profile_manager_unittest.cc
[modify] https://crrev.com/9a79b8191b3ddf8e37b22fb8f063278c592c07d5/chrome/browser/ui/ash/chrome_new_window_client_browsertest.cc

Status: Fixed (was: Assigned)
Project Member

Comment 12 by bugdroid1@chromium.org, Jun 15 2017

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

commit b674b355a83fe5d12a0dd883818aaebdd35006bd
Author: xiyuan <xiyuan@chromium.org>
Date: Thu Jun 15 15:43:04 2017

cros: Remove get user info code from OAuth2LoginManager

- Remove get user info code since it does not actually work.
  The missing account info should be fixed on the root cause
  instead of band-aid it in OAuth2LoginManager;
- Use std::string instead of std::string& for primary account id;

BUG= 728683 

Review-Url: https://codereview.chromium.org/2921653004
Cr-Commit-Position: refs/heads/master@{#479714}

[modify] https://crrev.com/b674b355a83fe5d12a0dd883818aaebdd35006bd/chrome/browser/chromeos/login/session/user_session_manager.cc
[modify] https://crrev.com/b674b355a83fe5d12a0dd883818aaebdd35006bd/chrome/browser/chromeos/login/signin/oauth2_login_manager.cc
[modify] https://crrev.com/b674b355a83fe5d12a0dd883818aaebdd35006bd/chrome/browser/chromeos/login/signin/oauth2_login_manager.h
[modify] https://crrev.com/b674b355a83fe5d12a0dd883818aaebdd35006bd/chrome/browser/chromeos/login/signin/oauth2_login_verifier.h

For the record, #12 is a clean-up and does not need to be merged.

Comment 14 by dchan@chromium.org, Jan 22 2018

Status: Archived (was: Fixed)

Sign in to add a comment