New issue
Advanced search Search tips

Issue 749506 link

Starred by 1 user

Issue metadata

Status: Started
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

[chrome/mash] FATAL:session_restore_stats_collector.cc(209)] Check failed: 0u < loading_tab_count_ (0 vs. 0)

Project Member Reported by toniki...@chromium.org, Jul 27 2017

Issue description

1- off-device build if chromeos/ozone with the following GN args:

  is_debug = false
  is_component_build = false
  dcheck_always_on = true

  target_os = "chromeos"

  use_ozone = true
  ozone_platform_x11 = true


2- launch chrome with: <out>/chrome --mash --ozone-platform=x11 --user-data-dir=<profile_name>
3- open chrome://settings and scrolldown to "On startup" section.
4- tick "continue where you left off" option.
5- close the settings and return to the chrome/mash browser
6- open and load two different URLs in two different tabs
7- the the last opened tab as active and close chrome and then the mash environment (e.g. control+c on terminal).

8- relaunch chrome with the same profile, same command line as before.
(the two tabs from the previous session should be loaded).

Assert is hit:

[3783:3783:0713/144712.376552:FATAL:session_restore_stats_collector.cc(209)] Check failed: 0u < loading_tab_count_ (0 vs. 0)
#0 0x55efb4d0fc27 base::debug::StackTrace::StackTrace()
#1 0x55efb4d29921 logging::LogMessage::~LogMessage()
#2 0x55efb4c421b6 SessionRestoreStatsCollector::Observe()
#3 0x55efb396bced content::NotificationServiceImpl::Notify()
#4 0x55efb3b4ccdf content::WebContentsImpl::LoadingStateChanged()
#5 0x55efb3b521cb content::WebContentsImpl::DidStopLoading()
#6 0x55efb3813aee content::FrameTreeNode::DidStopLoading()
#7 0x55efb384535a content::RenderFrameHostImpl::OnDidStopLoading()
#8 0x55efb38451d5 ZN3IPC8MessageTI32FrameHostMsg_DidStopLoading_MetaNSt3__15tupleIJEEEvE8DispatchIN7content19RenderFrameHostImplES8_vMS8_FvvEEEbPKNS_7MessageEPT_PT0_PT1_T2
#9 0x55efb383ab24 content::RenderFrameHostImpl::OnMessageReceived()
#10 0x55efb3a1fec9 content::RenderProcessHostImpl::OnMessageReceived()
#11 0x55efb58aa2b5 IPC::ChannelProxy::Context::OnDispatchMessage()
#12 0x55efb3341e10 _ZN4base8internal7InvokerINS0_9BindStateIMN5media17AudioOutputDeviceEFvRKNS3_15AudioParametersEEJ13scoped_refptrIS4_ES5_EEEFvvEE3RunEPNS0_13BindStateBaseE
#13 0x55efb30d9ed5 _ZNO4base8CallbackIFvvELNS_8internal8CopyModeE1ELNS2_10RepeatModeE1EE3RunEv
#14 0x55efb4dc1f3b base::debug::TaskAnnotator::RunTask()
#15 0x55efb4d310fd base::MessageLoop::RunTask()
#16 0x55efb4d31442 base::MessageLoop::DeferOrRunPendingTask()
#17 0x55efb4d317af base::MessageLoop::DoWork()
#18 0x55efb4d33f79 base::MessagePumpLibevent::Run()
#19 0x55efb4d30cbf base::MessageLoop::Run()
#20 0x55efb4d5a0c7 base::RunLoop::Run()
#21 0x55efb4be1ecf ChromeBrowserMainParts::MainMessageLoopRun()
#22 0x55efb3706f02 content::BrowserMainLoop::RunMainMessageLoopParts()
#23 0x55efb3709bdb content::BrowserMainRunnerImpl::Run()
#24 0x55efb3702658 content::BrowserMain()
#25 0x55efb496ba7c content::RunNamedProcessTypeMain()
#26 0x55efb496c5fd content::ContentMainRunnerImpl::Run()
#27 0x55efb4989ec1 service_manager::Main()
#28 0x55efb496ae92 content::ContentMain()
#29 0x55efb2ff6e0d ChromeMain
#30 0x7ff2905d8401 __libc_start_main
#31 0x55efb2ff6c50
 
Cc: kylec...@chromium.org sadrul@chromium.org sky@chromium.org
Status: Started (was: Untriaged)
Summary: [chrome/mash] FATAL:session_restore_stats_collector.cc(209)] Check failed: 0u < loading_tab_count_ (0 vs. 0) (was: [mash] FATAL:session_restore_stats_collector.cc(209)] Check failed: 0u < loading_tab_count_ (0 vs. 0))
I have analyzed the problem, and I think I understood what is going on.

When recovering tabs from a previous session, SessionRestoreImpl::RestoreTabsToBrowser takes place. It is expected that it loads the last active tab in a first pass, and on a second pass, SessionRestoreImpl::FinishedTabCreation loads the rest of the tabs.

However, in the first pass it is also expected that WebContentsViewAura instances are created for every tab, and temporarily parented according to the aura::Window set in the call to WindowParentingClient (see aura::client::SetWindowParentingClient).

For chromeos/mash, the aura window tree looks like this, for 2 tabs being recovered:

1-       Unknown<-1> (0x34ff86f77160) bounds(0, 0, 746, 431) WindowVisible LayerVisible opacity=1,0
2-          WebContentsViewAura<-1> (0x34ff872d2840) bounds(0, 0, 746, 358) WindowHidden LayerHidden opacity=1,0
3-          WebContentsViewAura<-1> (0x34ff86fd0160) bounds(0, 0, 746, 358) WindowHidden LayerHidden opacity=1,0

The WebContentsViewAura corresponding to the last active tab, then, continues with the loading procedure, as expected. During the process it gets re-parented accordingly, so that the tree looks like this:

1-       Unknown<-1> (0x34ff86f77160) bounds(0, 0, 746, 431) WindowVisible LayerVisible opacity=1,0
2-         DesktopNativeWidgetAura - content window<-1> (0x34ff86f77000) bounds(0, 0, 746, 431) WindowHidden LayerHidden opacity=1,0
3-          NativeViewHostAuraClip<-1> (0x34ff8635d1e8) bounds(0, 73, 746, 358) WindowVisible LayerVisible opacity=1,0
4-            WebContentsViewAura<-1> (0x34ff872d2840) bounds(0, 0, 746, 358) WindowVisible LayerVisible opacity=1,0
5-              RenderWidgetHostViewAura<-1> (0x34ff872d2dc0) bounds(0, 0, 746, 358) WindowVisible LayerVisible opacity=1,0
6-        WebContentsViewAura<-1> (0x34ff86fd0160) bounds(0, 0, 746, 358) WindowHidden LayerHidden opacity=1,0

where:

* 1/Unknown is the WindowParentingClient aura::Window. 
* line 4 shows the WebContentsViewAura already re-parented, and with a valid RenderWidgetHostViewAura child, indicating the loading proceeded ok.
* line 6 still has a dummy WebContentsViewAura child of the WindowParentingClient aura::Window.

-----------------------
The problem starts here
-----------------------

WebContentsViewAura instances corresponding to other tabs (not the active one), should not be loaded in the first pass, but they do, because of the way the aura window tree is constructed.

All dummy WebContentsViewAura are child of the WindowParentingClient aura::Window, when it is set to visible, as part of the browser start up, it notifies all its observers, including the dummy WebContentsViewAura instances.

So this calls WebContentsViewAura::OnWindowVisibilityChanged on the non-active ones, which trigger navigation/loading for them.

  2 #1 0x55807d783999 content::WebContentsImpl::DidStartLoading()
  (...)
  9 #7 0x55807d461214 content::NavigationControllerImpl::NavigateToPendingEntry()
 10 #8 0x55807d777b4d content::WebContentsImpl::WasShown()
 10 #9 0x55807d7ctb00 content::WebContentsViewAura::OnWindowVisibilityChanged()
 11 #10 0x55807fb84ff6 aura::Window::NotifyWindowVisibilityChangedAtReceiver()
 12 #11 0x55807fb84da2 aura::Window::NotifyWindowVisibilityChangedDown()
 13 #12 0x55807fb82ac0 aura::Window::SetVisible()
 14 #13 0x55807fb828c8 aura::Window::Show()
 15 #14 0x5580826aa092 views::NativeViewHostAura::ShowWidget()
 16 #15 0x55808269d0ab views::NativeViewHost::Layout()
 17 #16 0x55808269cf06 views::NativeViewHost::Attach()
 18 #17 0x558080a80194 views::WebView::AttachWebContents()
 (...)
 26 #25 0x55808083cd8c chrome::AddRestoredTab()
 27 #26 0x55807e7a16f0 SessionRestoreImpl::RestoreTab()
 28 #27 0x55807e7a0273 SessionRestoreImpl::RestoreTabsToBrowser()
 29 #28 0x55807e79f85b SessionRestoreImpl::ProcessSession
 (...)

Down the road, SessionRestoreStatsCollector expects that only the last active tab is loaded in the first pass. But, as said above, in the case of mash, all tabs are loaded. When the tabs finish loading, the assert is hit.

NOTE: In chromeos/mus, it does not happen because the ::SetWindowParentingClient sets the window upper in Ash's window hierarchy tree, and dummy WebContentsViewAura instances, temporarily children of it, are not affected when the browser window is set to visible.
Project Member

Comment 2 by bugdroid1@chromium.org, Aug 1 2017

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

commit 284943d5dc070f507b5ffaacce110afc7411bf82
Author: Antonio Gomes <tonikitoo@igalia.com>
Date: Tue Aug 01 04:11:29 2017

Factor out some duplicated logic in SessionRestoreImpl::RestoreTabsToBrowser

The method SessionRestoreImpl::RestoreTabsToBrowser executes in two ways:

- user is recovering a previous session and creating a new browser session
for that.
- user is recovering a previous session and (re)using an existing browser
session for that.

Both paths have similar logic, with some peculiarities, that is now is shared
with this PR.

This is a preparation step to fix Bug 749506:
https://chromium-review.googlesource.com/c/593868/

TEST=no behavior change, so no new tests needed.

BUG=749506

Change-Id: I6974d24defb8681a7a2e736f1ee98861d9ee316b
Reviewed-on: https://chromium-review.googlesource.com/593867
Reviewed-by: Scott Violet <sky@chromium.org>
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Cr-Commit-Position: refs/heads/master@{#490847}
[modify] https://crrev.com/284943d5dc070f507b5ffaacce110afc7411bf82/chrome/browser/sessions/session_restore.cc

Components: -Internals>MUS Internals>Services>WindowService

Sign in to add a comment