Repository navigation
Give a starting Chromium longer to observe the browser location timezone - #484
Closed
tnsardesai wants to merge 1 commit into
Closed
tnsardesai wants to merge 1 commit into
tnsardesai wants to merge 1 commit into
Conversation
Contributor
Author
|
Closing in favor of applying the location before the configure restart, so it no longer depends on Chromium startup time. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Right after Chromium starts,
PUT /browser/locationcan fail withbrowser location components have not converged. This happens most often when a profile restores a saved tab that loads slowly.A Chromium that has just started does not react when
/etc/localtimeis replaced, so the location's timezone never converges. Each reconcile round replaces the file again, about every 1.55s. Chromium reacts to the first replacement it sees after it finishes starting, and the location converges a few milliseconds later. When a profile restores a slow tab, startup can take longer than the 5s apply deadline. The reconcile then gives up just before Chromium would have seen the next replacement.The timeout is now split in two:
browserLocationApplyTimeout(5s, unchanged) is how long an attempt has to converge.browserLocationStartupTimeout(10s, new) is how long Chromium has, counted from when its DevTools endpoint comes up, before it is expected to notice the timezone file being replaced.An attempt now stops at whichever of the two ends later. A Chromium that has finished starting still gets exactly 5s.
waitBrowserLocationApplieduses the same deadline. To support this,UpstreamManager.Since()records when the current DevTools URL was discovered, in wall-clock time.When a location fails to converge, the error log now includes the component status, so a prod failure shows which component is stuck.
Repro (prod image, profile whose saved tab is
https://httpbin.org/delay/9)I polled
GET /browser/locationinside the VM while sendingPUT /browser/locationabout 1.5s after Chromium came up:/etc/localtime, at about 4.65sThe
PUTreturned 200 after 4.7s, just inside the 5s deadline. One in six creates with this profile pluslocationfailed in prod. The samePUTsent to the same browser 12s after start converged in 30ms.Testing
TestSetBrowserLocationWaitsForStartingChromiumToObserveTimezonereproduces the bug with a fake Chromium that ignores timezone file replacements until 5.5s after it starts. It fails on main with a 500 after 5s and passes with this change.TestBrowserLocationDeadlinecovers the deadline for an unknown Chromium, a settled one and a starting one.go test -race ./cmd/api/api/ -run 'BrowserLocation|Reapply'andgo test ./cmd/api/... ./lib/devtoolsproxy/...pass.go vetis clean.Notes
Since()is reset to the restart time. A failing location sent in the next 10s waits longer than it needs to before it fails.