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

Issue 733452 link

Starred by 4 users

Issue metadata

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



Sign in to add a comment

WebView shell does not shut down cleanly

Project Member Reported by eugene...@chromium.org, Jun 15 2017

Issue description

Two DCHECKs occur when you swipe up to quit the shell app in ios multi-tasking menu.
Stack traces below.

To repro:
1) Launch ios web view shell.
2) Open multi tasking menu.
3) Remove the app in the menu to quit the app.

 
Owner: michaeldo@chromium.org
Status: Assigned (was: Untriaged)
 Issue 748128  has been merged into this issue.
Project Member

Comment 3 by bugdroid1@chromium.org, Dec 14 2017

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

commit c24f6f7d1b280440342a5a80d33ca6a02a395bf2
Author: John Z Wu <jzw@chromium.org>
Date: Thu Dec 14 02:50:06 2017

Clean shut down for //ios/web_view.

If you quit the app in iOS multitasking, it DCHECKs in a few places. This makes it impossible to
write integration tests.

This happens because, in our current setup, ObjC classes stay around longer than C++ classes.
More specifically, CWVWebViewConfiguration stays around longer than WebViewWebMainParts.
Since any client may retain CWVWebViewConfiguration for any reason, we cannot rely on dealloc to
clean things up. Instead, a |shutDown| method is used to tear things down in the proper order.

Bug: 733452
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I5c7b3e2f5fc81ee9d67e3a8a499301e4c814726e
Reviewed-on: https://chromium-review.googlesource.com/825444
Commit-Queue: John Wu <jzw@chromium.org>
Reviewed-by: Mike Dougherty <michaeldo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#523991}
[modify] https://crrev.com/c24f6f7d1b280440342a5a80d33ca6a02a395bf2/ios/web_view/BUILD.gn
[modify] https://crrev.com/c24f6f7d1b280440342a5a80d33ca6a02a395bf2/ios/web_view/internal/autofill/cwv_autofill_controller.mm
[modify] https://crrev.com/c24f6f7d1b280440342a5a80d33ca6a02a395bf2/ios/web_view/internal/cwv_web_view.mm
[modify] https://crrev.com/c24f6f7d1b280440342a5a80d33ca6a02a395bf2/ios/web_view/internal/cwv_web_view_configuration.mm
[modify] https://crrev.com/c24f6f7d1b280440342a5a80d33ca6a02a395bf2/ios/web_view/internal/cwv_web_view_configuration_internal.h
[add] https://crrev.com/c24f6f7d1b280440342a5a80d33ca6a02a395bf2/ios/web_view/internal/cwv_web_view_internal.h
[modify] https://crrev.com/c24f6f7d1b280440342a5a80d33ca6a02a395bf2/ios/web_view/internal/web_view_web_main_parts.mm

Comment 4 by jzw@chromium.org, Dec 14 2017

URLRequestContextGetter leaks when quitting ios_web_view_shell through iOS multitasking menu.

[1214/114503.100761:ERROR:leak_tracker.h(101)] Leaked 0x7fd14f017738 which was allocated by:
[1214/114503.100872:ERROR:leak_tracker.h(102)] 0   ChromeWebView                       0x000000010958917d base::debug::StackTrace::StackTrace(unsigned long) + 157
1   ChromeWebView                       0x00000001095891bd base::debug::StackTrace::StackTrace(unsigned long) + 29
2   ChromeWebView                       0x00000001095876cc base::debug::StackTrace::StackTrace() + 28
3   ChromeWebView                       0x0000000109e54a0f base::debug::LeakTracker<io_thread::SystemURLRequestContextGetter>::LeakTracker() + 47
4   ChromeWebView                       0x0000000109e49295 base::debug::LeakTracker<io_thread::SystemURLRequestContextGetter>::LeakTracker() + 21
5   ChromeWebView                       0x0000000109e4923d io_thread::SystemURLRequestContextGetter::SystemURLRequestContextGetter(io_thread::IOSIOThread*) + 93
6   ChromeWebView                       0x0000000109e492bd io_thread::SystemURLRequestContextGetter::SystemURLRequestContextGetter(io_thread::IOSIOThread*) + 29
7   ChromeWebView                       0x0000000109e4eeb7 io_thread::IOSIOThread::system_url_request_context_getter() + 551
8   ChromeWebView                       0x00000001090ce5cb ios_web_view::ApplicationContext::GetSystemURLRequestContext() + 251
9   ChromeWebView                       0x00000001090f4393 ios_web_view::WebViewTranslateService::Initialize() + 51
10  ChromeWebView                       0x0000000109103909 ios_web_view::WebViewWebMainParts::PreMainMessageLoopRun() + 25
11  ChromeWebView                       0x0000000109533209 web::WebMainLoop::PreMainMessageLoopRun() + 105
12  ChromeWebView                       0x00000001095321d0 web::WebMainLoop::CreateStartupTasks(base::OnceCallback<std::__1::unique_ptr<base::TaskScheduler::InitParams, std::__1::default_delete<base::TaskScheduler::InitParams> > ()>) + 192
13  ChromeWebView                       0x0000000109534b57 web::WebMainRunnerImpl::Initialize(web::WebMainParams) + 999
14  ChromeWebView                       0x000000010952ed8a web::WebMain::WebMain(web::WebMainParams) + 506
15  ChromeWebView                       0x000000010952ef05 web::WebMain::WebMain(web::WebMainParams) + 21
16  ChromeWebView                       0x00000001090f82c7 decltype(std::make_unique<web::WebMain>(std::forward<web::WebMainParams>(fp))) base::MakeUnique<web::WebMain, web::WebMainParams>(web::WebMainParams&&) + 167
17  ChromeWebView                       0x00000001090f7d5b ___ZN12ios_web_view21InitializeGlobalStateEv_block_invoke + 1627
18  libdispatch.dylib                   0x000000010fb3833d _dispatch_client_callout + 8
19  libdispatch.dylib                   0x000000010fb398c8 dispatch_once_f + 297
20  ChromeWebView                       0x00000001090f748b ios_web_view::InitializeGlobalState() + 763
21  ChromeWebView                       0x00000001090d9bb5 +[CWVWebView initialize] + 69
22  libobjc.A.dylib                     0x0000000106bc3a14 CALLING_SOME_+initialize_METHOD + 19
23  libobjc.A.dylib                     0x0000000106bc3dae _class_initialize + 276
24  libobjc.A.dylib                     0x0000000106bca5e7 lookUpImpOrForward + 225
25  libobjc.A.dylib                     0x0000000106bda3d4 _objc_msgSend_uncached + 68
26  ios_web_view_shell                  0x00000001017eec96 -[ShellViewController viewDidLoad] + 3238
27  UIKit                               0x0000000101cb646c -[UIViewController loadViewIfRequired] + 1235
28  UIKit                               0x0000000101cb68b9 -[UIViewController view] + 27
29  UIKit                               0x0000000101b817cf -[UIWindow addRootViewControllerViewIfPossible] + 122
30  UIKit                               0x0000000101b81ed7 -[UIWindow _setHidden:forced:] + 294
31  UIKit                               0x00000001251ecbdd -[UIWindowAccessibility _orderFrontWithoutMakingKey] + 86
32  UIKit                               0x0000000101b94e54 -[UIWindow makeKeyAndVisible] + 42
33  ios_web_view_shell                  0x00000001017eb767 -[ShellAppDelegate application:didFinishLaunchingWithOptions:] + 119
34  UIKit                               0x0000000101b05bca -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 299
35  UIKit                               0x0000000101b07648 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4113
36  UIKit                               0x0000000101b0caeb -[UIApplication _runWithMainScene:transitionContext:completion:] + 1720
37  UIKit                               0x0000000101ed66f8 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 924
38  UIKit                               0x00000001022ac4c8 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
39  UIKit                               0x0000000101ed62f1 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 249
40  UIKit                               0x0000000101ed6b6b -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 696
41  UIKit                               0x0000000102854a69 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 262
42  UIKit                               0x0000000102854922 -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 444
43  UIKit                               0x00000001025319c8 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 221
44  UIKit                               0x0000000102730b06 _performActionsWithDelayForTransitionContext + 100
45  UIKit                               0x000000010253188b -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 231
46  UIKit                               0x00000001022abb25 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
47  UIKit                               0x0000000101b0b36a -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 523
48  UIKit                               0x00000001020e6605 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 369
49  FrontBoardServices                  0x0000000107807cc0 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 338
50  FrontBoardServices                  0x00000001078107b5 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 235
51  libdispatch.dylib                   0x000000010fb3833d _dispatch_client_callout + 8
52  libdispatch.dylib                   0x000000010fb3d9f3 _dispatch_block_invoke_direct + 592
53  FrontBoardServices                  0x000000010783c498 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
54  FrontBoardServices                  0x000000010783c14e -[FBSSerialQueue _performNext] + 464
55  FrontBoardServices                  0x000000010783c6bd -[FBSSerialQueue _performNextFromRunLoopSource] + 45
56  CoreFoundation                      0x0000000103d4b101 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
57  CoreFoundation                      0x0000000103deaf71 __CFRunLoopDoSource0 + 81
58  CoreFoundation                      0x0000000103d2fa19 __CFRunLoopDoSources0 + 185
59  CoreFoundation                      0x0000000103d2efff __CFRunLoopRun + 1279
60  CoreFoundation                      0x0000000103d2e889 CFRunLoopRunSpecific + 409
61  GraphicsServices                    0x00000001084869c6 GSEventRunModal + 62

[1214/114503.130802:FATAL:leak_tracker.h(106)] Check failed: 0u == count (0 vs. 1)
 

Comment 5 by jzw@chromium.org, Dec 14 2017

Happens because CWVAutofillController's WebViewAutofillClient outlives SigninManager.

[1214/115823.766023:FATAL:observer_list.h(224)] Check failed: observers_.empty(). 

Comment 6 by jzw@chromium.org, Dec 14 2017

Description: Show this description

Comment 7 by jzw@chromium.org, Dec 14 2017

Summary: WebView shell does not shut down cleanly (was: ShellTestCase.testLoadingURL DCHECKs)

Comment 8 by jzw@chromium.org, Dec 14 2017

Cc: eugene...@chromium.org
Owner: jzw@chromium.org

Comment 9 by jzw@chromium.org, Dec 14 2017

Cc: jzw@chromium.org
 Issue 795058  has been merged into this issue.

Comment 10 by jzw@chromium.org, Dec 14 2017

 Issue 795053  has been merged into this issue.
What is the expected lifetime of SigninManager? Die before WebState or before BrowserState?

Comment 12 by jzw@chromium.org, Dec 14 2017

It is created from WebViewSignInManagerFactory so it should go away with BrowserState.

Comment 13 by jzw@chromium.org, Jan 24 2018

Status: Fixed (was: Assigned)
Status: Assigned (was: Fixed)
It looks like there is still a reference to this bug in source so I'll re-open for now.

https://cs.chromium.org/chromium/src/ios/web_view/shell/test/shell_egtest.mm?rcl=399e97834e0f1b08ee104789a87482fd79712da0&l=78

Sign in to add a comment