This happens because the WebViewBrowserState was not deleted before WebViewMainParts.
[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)
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 1 by jzw@chromium.org
, Dec 14 2017