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

Issue 2585053002: Fix telemetry hangs with PlzNavigate. (Closed)

Created:
4 years ago by jam
Modified:
4 years ago
Reviewers:
clamy, dgozman
CC:
chromium-reviews, jam, nasko+codewatch_chromium.org, darin-cc_chromium.org, creis+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix telemetry hangs with PlzNavigate. This was caused because some inspector protocol messages were being dropped with PlzNavigate with cross-process navigations. The scenario is that 1) FrameHostHolder::DispatchProtocolMessage was being called before the navigation happens. It adds the message to sent_messages_. 2) AboutToNavigate(NavigationHandle* navigation_handle) is called 3) FrameHostHolder::SendMessageToClient is called since the first renderer has responded to the protocol message from 1). It removes the sent message from sent_messages_ and forwards the reply using SendMessageToClient. 4) ReadyToCommitNavigation is called, which only then creates the pending FrameHostHolder 5) DidFinishNavigation is called which sets current_ to pending_. This manifested in hangs with telemetry, since in cross-process navigations the Page.navigate command was being recieved incorrectly in the first renderer and it was sending a frameId from that renderer. The catapult code was waiting for a navigation event for that frameId which would never come (it would get it from the new process instead). There were two bugs here with PlzNavigate, compared to the non-PlzNavigate case. 1 The first FrameHostHolder (i.e. current_ during the navigation) was not being paused. This was leading to responses to messages that were sent to the first renderer to respond to the inspector client. Since the response arrived, sent_messages_ was being cleared and we never got to send the message to the new renderer. 2) Even with the above fixed, we had to keep track of messages that were sent to the first renderer while the FrameHostHolder is (now) suspended. This didn't need to happen in the non-PlzNavigate case because the pending FrameHostHolder is created immediately (in the equivalent to step 2 above). At that point in time, SetPending ends up calling Reattach which then grabs the sent_messages_ from the current_ FrameHostHolder. The Page.navigate message was therefore being sent correctly to the second process. When the first process replies, it's ignored since it goes into pending_messages_ buffer. With PlzNavigate, there's a period of time between 2) and 4) where we know we have a navigation but we don't have the RenderFrameHost yet. So we need to emulate the non-PlzNavigate behavior by holding on to sent messages during that window, so that we can send them to the new FrameHostHolder once it commits. This fixes telemetry_unittests' testWebPageReplay, gpu_process_launch_tests, hardware_accelerated_feature_tests and the page cyclers with PlzNavigate. BUG=674730 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation Committed: https://crrev.com/af4c3f9c6ca41f00427a0f1f8de02782ce227629 Cr-Commit-Position: refs/heads/master@{#439592}

Patch Set 1 #

Patch Set 2 : with plznav enabled #

Patch Set 3 : fix for DevToolsProtocolTest.CrossSitePauseInBeforeUnload #

Patch Set 4 : now disable plznav again #

Patch Set 5 : better fix to match non-plznavigate case #

Patch Set 6 : now disable plznav again #

Patch Set 7 : better fix to match non-plznavigate case #

Patch Set 8 : now disable plznav again #

Total comments: 10

Patch Set 9 : review comment (with PlzNavigate enabled) #

Patch Set 10 : now disable plznav again #

Unified diffs Side-by-side diffs Delta from patch set Stats (+19 lines, -3 lines) Patch
M content/browser/devtools/render_frame_devtools_agent_host.cc View 1 2 3 4 5 6 7 8 6 chunks +19 lines, -3 lines 0 comments Download

Messages

Total messages: 61 (52 generated)
jam
4 years ago (2016-12-19 15:58:41 UTC) #34
dgozman
Thank you for the fix! lgtm https://codereview.chromium.org/2585053002/diff/160001/content/browser/devtools/render_frame_devtools_agent_host.cc File content/browser/devtools/render_frame_devtools_agent_host.cc (right): https://codereview.chromium.org/2585053002/diff/160001/content/browser/devtools/render_frame_devtools_agent_host.cc#newcode601 content/browser/devtools/render_frame_devtools_agent_host.cc:601: if (!navigating_handles_.empty()) { ...
4 years ago (2016-12-19 18:26:45 UTC) #35
jam
https://codereview.chromium.org/2585053002/diff/160001/content/browser/devtools/render_frame_devtools_agent_host.cc File content/browser/devtools/render_frame_devtools_agent_host.cc (right): https://codereview.chromium.org/2585053002/diff/160001/content/browser/devtools/render_frame_devtools_agent_host.cc#newcode601 content/browser/devtools/render_frame_devtools_agent_host.cc:601: if (!navigating_handles_.empty()) { On 2016/12/19 18:26:44, dgozman wrote: > ...
4 years ago (2016-12-19 20:13:02 UTC) #36
dgozman
https://codereview.chromium.org/2585053002/diff/160001/content/browser/devtools/render_frame_devtools_agent_host.cc File content/browser/devtools/render_frame_devtools_agent_host.cc (right): https://codereview.chromium.org/2585053002/diff/160001/content/browser/devtools/render_frame_devtools_agent_host.cc#newcode708 content/browser/devtools/render_frame_devtools_agent_host.cc:708: current_->Resume(); On 2016/12/19 20:13:02, jam wrote: > On 2016/12/19 ...
4 years ago (2016-12-19 20:29:52 UTC) #42
nasko
https://codereview.chromium.org/2585053002/diff/160001/content/browser/devtools/render_frame_devtools_agent_host.cc File content/browser/devtools/render_frame_devtools_agent_host.cc (right): https://codereview.chromium.org/2585053002/diff/160001/content/browser/devtools/render_frame_devtools_agent_host.cc#newcode708 content/browser/devtools/render_frame_devtools_agent_host.cc:708: current_->Resume(); On 2016/12/19 20:29:52, dgozman wrote: > On 2016/12/19 ...
4 years ago (2016-12-19 20:59:00 UTC) #49
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2585053002/220001
4 years ago (2016-12-19 22:18:46 UTC) #55
jam
https://codereview.chromium.org/2585053002/diff/160001/content/browser/devtools/render_frame_devtools_agent_host.cc File content/browser/devtools/render_frame_devtools_agent_host.cc (right): https://codereview.chromium.org/2585053002/diff/160001/content/browser/devtools/render_frame_devtools_agent_host.cc#newcode708 content/browser/devtools/render_frame_devtools_agent_host.cc:708: current_->Resume(); On 2016/12/19 20:59:00, nasko wrote: > On 2016/12/19 ...
4 years ago (2016-12-19 22:23:15 UTC) #56
commit-bot: I haz the power
Committed patchset #10 (id:220001)
4 years ago (2016-12-19 22:25:07 UTC) #59
commit-bot: I haz the power
4 years ago (2016-12-19 22:29:22 UTC) #61
Message was sent while issue was closed.
Patchset 10 (id:??) landed as
https://crrev.com/af4c3f9c6ca41f00427a0f1f8de02782ce227629
Cr-Commit-Position: refs/heads/master@{#439592}

Powered by Google App Engine
This is Rietveld 408576698