New issue
Advanced search Search tips

Issue 809166 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Feb 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 1
Type: Bug


Previous locations:
gerrit:8266


Sign in to add a comment

cr-buildbucket-client.js makes thousands of requests

Project Member Reported by dsinclair@chromium.org, Feb 2 2018

Issue description

Looking at the network console when Gerrit is open I'm seeing multiple requests from cr-buildbucket-client per second. This is on pdfium-review.googlesource.com.

Devtools lists the callstack as:

_fetchWithTags	@	cr-buildbucket-client.js:139
getBuilds	@	cr-buildbucket-client.js:99
$.client.getOAuthToken.then	@	cr-buildbucket-view.js:109
Promise.then (async)		
_refreshBuilds	@	cr-buildbucket-view.js:108
_updateTimerFired	@	cr-buildbucket-view.js:164
setTimeout (async)		
$.client.getBuilds.then.catch.then	@	cr-buildbucket-view.js:118
Promise.then (async)		
$.client.getOAuthToken.then	@	cr-buildbucket-view.js:116
Promise.then (async)		
_refreshBuilds	@	cr-buildbucket-view.js:108
_updateTimerFired	@	cr-buildbucket-view.js:164
setTimeout (async)		
$.client.getBuilds.then.catch.then	@	cr-buildbucket-view.js:118
Promise.then (async)		
$.client.getOAuthToken.then	@	cr-buildbucket-view.js:116
Promise.then (async)		
_refreshBuilds	@	cr-buildbucket-view.js:108
_updateTimerFired	@	cr-buildbucket-view.js:164
setTimeout (async)		
$.client.getBuilds.then.catch.then	@	cr-buildbucket-view.js:118
Promise.then (async)		
$.client.getOAuthToken.then	@	cr-buildbucket-view.js:116
Promise.then (async)		
_refreshBuilds	@	cr-buildbucket-view.js:108
_updateTimerFired	@	cr-buildbucket-view.js:164
setTimeout (async)		
$.client.getBuilds.then.catch.then	@	cr-buildbucket-view.js:118
Promise.then (async)		
$.client.getOAuthToken.then	@	cr-buildbucket-view.js:116
Promise.then (async)		
_refreshBuilds	@	cr-buildbucket-view.js:108
_updateTimerFired	@	cr-buildbucket-view.js:164
setTimeout (async)		
$.client.getBuilds.then.catch.then	@	cr-buildbucket-view.js:118
Promise.then (async)		
$.client.getOAuthToken.then	@	cr-buildbucket-view.js:116
Promise.then (async)		
_refreshBuilds	@	cr-buildbucket-view.js:108
_updateTimerFired	@	cr-buildbucket-view.js:164
setTimeout (async)		
$.client.getBuilds.then.catch.then	@	cr-buildbucket-view.js:118
Promise.then (async)		
$.client.getOAuthToken.then	@	cr-buildbucket-view.js:116
Promise.then (async)		
_refreshBuilds	@	cr-buildbucket-view.js:108
_updateTimerFired	@	cr-buildbucket-view.js:164
setTimeout (async)		
$.client.getBuilds.then.catch.then	@	cr-buildbucket-view.js:118
Promise.then (async)		
$.client.getOAuthToken.then	@	cr-buildbucket-view.js:116
Promise.then (async)		
_refreshBuilds	@	cr-buildbucket-view.js:108
_updateTimerFired	@	cr-buildbucket-view.js:164

 

Comment 2 by wyatta@google.com, Feb 2 2018

Cc: aga...@chromium.org
This is wacky. I can reproduce this by visiting a pdfium review. But not when visiting a chromium review. On chromium, the plugin only updates (and therefore sends network requests) once every 5 seconds, as it is supposed to: https://chromium.googlesource.com/infra/gerrit-plugins/buildbucket/+/master/src/main/resources/static/cr-buildbucket-view.js#7
It appears that pdfium is updating once every five seconds... but is doing so twice. Each time it wakes up, it issues *two* options requests, and *two* get requests, per patchset, rather than one of each like it is supposed to. And those two instances sending duplicate requests seem to be able to get out of sync, causing it to look like it is updating every two or three seconds.
Even weirder, switching away from the pdfium tab and then back again seems to fix this.

Comment 6 by logan@google.com, Feb 5 2018

Project: chromium
Moved issue gerrit:8266 to now be  issue chromium:809166 .

Comment 7 by logan@google.com, Feb 5 2018

Components: Infra>Codereview>Gerrit
Project Member

Comment 8 by bugdroid1@chromium.org, Feb 5 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/infra/gerrit-plugins/buildbucket/+/d575eaf88b5ce1344e2817cb3e14292a49347925

commit d575eaf88b5ce1344e2817cb3e14292a49347925
Author: Nodir Turakulov <nodir@google.com>
Date: Mon Feb 05 23:34:32 2018

[buildbucket] clear update timer

Bug 1: Buildbucket plugin makes O(N) requests every 5 sec, where
N is the number of CLs visited in the same Chrome tab. This happens
because window timeout is never explicitly cleared.

 Bug 2 : if a CL is open and then user navigates back to the dashboard,
the plugin continues to poll buildbucket.

Together, they caused excessive QPS on Buildbucket. According to Buildbucket
logs, majority of search requests from Gerrit came with referral
"https://chromium-review.googlesource.com/dashboard/self".

This CL fixes both CLs by clearing update timeout on detach and before
creating a new timeout. Also it reverts 9edbc39289f531744a5e418a35967328b7a98c79

Bug: 803356,  809166 
Change-Id: I72c00c5b8f7871fb9f65bf0df0a853b6115f39b9
Reviewed-on: https://chromium-review.googlesource.com/902815
Reviewed-by: Aaron Gable <agable@chromium.org>

[modify] https://crrev.com/d575eaf88b5ce1344e2817cb3e14292a49347925/src/main/resources/static/cr-buildbucket-view.js

Comment 9 by no...@chromium.org, Feb 6 2018

Labels: Pri-1 Type-Bug
Owner: no...@chromium.org
Status: Started (was: New)
Components: Infra>Platform>Buildbucket
I wish I was CCed on this bug. It would help investigating the buildbucket quota exhaustion. Aaron, please add buildbucket component on buildbucket plugin bugs in the future (I’m watching them)
Sure, will do (fair warning, there can be a lot of them).

Comment 12 by no...@chromium.org, Feb 12 2018

Status: Fixed (was: Started)

Sign in to add a comment