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

Issue 632740 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Aug 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 1
Type: Bug



Sign in to add a comment

Initial fetch is made too early.

Project Member Reported by dgn@chromium.org, Jul 29 2016

Issue description

Observed on N6, connected on GIN-2G:

(already logged in, cleared stored snippets, then killed and restarted Chrome on the NTP)

UI:
- NTP loads
- "No snippets" card loads
- ...
- ...
- Hit the reload button
- Snippets are displayed

Logs: (I added some more, but the logic is the same)

I/chromium: [INFO:ntp_snippets_service.cc(763)] DGN - EnterState(0, 2)                                       <= Initial connection to the DB in the constructor
V/chromium: [VERBOSE1:ntp_snippets_status_service.cc(82)] [GetNewDisabledReason] Enabled
I/chromium: [INFO:ntp_snippets_service.cc(763)] DGN - EnterState(1, 2)                                       <= DB load finished
V/chromium: [VERBOSE1:ntp_snippets_service.cc(780)] Entering state: READY
I/chromium: [INFO:ntp_snippets_service.cc(263)] DGN - Initiating fetch                                       <= We had no snippets se we do a fetch
E/chromium: [ERROR:ntp_snippets_fetcher.cc(440)] Unable to get token: Request canceled. - fetching the snippets without authentication.   <= Uh oh...
I/chromium: [INFO:ntp_snippets_service.cc(836)] DGN - UpdateCategoryStatus 1
D/cr_DGN  : [StatusListItem.java:142] StatusListItem#create(AVAILABLE)                                       <= UI notified of the results from fetch
D/cr_NtpCards: [StatusListItem.java:89] Registering card for status: No Snippets
D/cr_Ntp  : [NewTabPageAdapter.java:144] Received 0 new snippets.

I/chromium: [INFO:ntp_snippets_service.cc(263)] DGN - Initiating fetch                                       <= Hit reload on the card
I/chromium: [INFO:ntp_snippets_service.cc(836)] DGN - UpdateCategoryStatus 2
D/cr_DGN  : [StatusListItem.java:146] StatusListItem#create(AVAILABLE_LOADING)
D/cr_NtpCards: [StatusListItem.java:89] Registering card for status: No Snippets
V/chromium: [VERBOSE1:ntp_snippets_fetcher.cc(358)] Sending a NTP snippets request to https://...            <= Now it loads!


I removed the dependency on sync (https://codereview.chromium.org/2191343002/), which makes us do the initial fetch much earlier. That seems to early for the fetcher (hit OnGetTokenFailure) even though we are definitely signed in. Should the fetcher cache the request until it knows it can make it?
 

Comment 1 by dgn@chromium.org, Jul 29 2016

Labels: -Pri-3 Pri-1

Comment 2 by fi...@chromium.org, Jul 29 2016

Labels: -zine-client-v1 zine-articles-v1 zine-triaged
Status: Available (was: Untriaged)

Comment 3 by fi...@chromium.org, Jul 29 2016

Labels: M54

Comment 4 by treib@chromium.org, Aug 1 2016

Labels: -M54 M-54 zine-16-08-01
Owner: treib@chromium.org
Status: Assigned (was: Available)
I'll try to take a look this week.

Possible solution:
OAuth2TokenService::Observer has an OnRefreshTokensLoaded method - "Called after all refresh tokens are loaded during OAuth2TokenService startup". Maybe we need to wait for that before attempting a fetch?

Comment 5 by treib@chromium.org, Aug 5 2016

Labels: zine-client-v1

Comment 6 by treib@chromium.org, Aug 5 2016

Status: Started (was: Assigned)

Comment 7 by treib@chromium.org, Aug 5 2016

Labels: zine-16-08-08

Comment 8 by treib@chromium.org, Aug 8 2016

Cc: jkrcal@chromium.org
Owner: jkrcal@chromium.org
Project Member

Comment 10 by bugdroid1@chromium.org, Aug 11 2016

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

commit 36f23cf9e0aae1b88b19afab849ac4a7c80d5e80
Author: jkrcal <jkrcal@chromium.org>
Date: Thu Aug 11 14:35:26 2016

Add robustness against OAuth2 Token requests getting canceled.

OAuth2 token requests get canceled whenever new refresh tokens are
loaded. On Android this happens soon after startup and (on slow devices)
quite reliably cancels the requests for content suggestions.

This CL adds one retry in case the token request gets canceled.

BUG= 632740 

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

[modify] https://crrev.com/36f23cf9e0aae1b88b19afab849ac4a7c80d5e80/components/ntp_snippets/ntp_snippets_fetcher.cc
[modify] https://crrev.com/36f23cf9e0aae1b88b19afab849ac4a7c80d5e80/components/ntp_snippets/ntp_snippets_fetcher.h

Status: Fixed (was: Started)

Sign in to add a comment