Skip to content

Webview Main Thread Checker: UI API called on a background thread #68490

Closed
@karmelcorn

Description

@karmelcorn

Steps to Reproduce

  1. Build the example app with webview_flutter 1.0.3 (https://pub.dev/packages/webview_flutter/example)
  2. Go to any url, eg: www.bravenewlook.com or www.yahoo.com

Expected results:
Webpage rendered properly without error.

Actual results:
Webpage is rendered but the follow error is throw in Xcode on a physical device. Error does not occur for simulator.
App hangs for 10sec when the error is thrown.

For www.bravenewlook.com, the error is thrown the first time the webview screen is closed.
For www.yahoo.com, the error is thrown on the third time the webview screen is closed.

App continue to work and error is not throw again after the first time.

=================================================================
Main Thread Checker: UI API called on a background thread: -[UIView removeFromSuperview]
PID: 15100, TID: 4349740, Thread name: io.flutter.1.raster, Queue name: com.apple.root.default-qos.overcommit, QoS: 0
Backtrace:
4   Flutter                             0x0000000102bd5c70 _ZN7flutter30FlutterPlatformViewsController11SubmitFrameEP15GrDirectContextNSt3__110shared_ptrINS_10IOSContextEEENS3_10unique_ptrINS_12SurfaceFrameENS3_14default_deleteIS8_EEEE + 4932
5   Flutter                             0x0000000102bef100 _ZN7flutter10IOSSurface11SubmitFrameEP15GrDirectContextNSt3__110unique_ptrINS_12SurfaceFrameENS3_14default_deleteIS5_EEEE + 160
6   Flutter                             0x0000000102ec5764 _ZN7flutter10Rasterizer13DrawToSurfaceERNS_9LayerTreeE + 604
7   Flutter                             0x0000000102ec62a0 _ZNSt3__110__function6__funcIZN7flutter10Rasterizer4DrawEN3fml6RefPtrINS2_8PipelineINS2_9LayerTreeEEEEEE3$_1NS_9allocatorISA_EEFvNS_10unique_ptrIS7_NS_14default_deleteIS7_EEEEEEclEOSG_ + 116
8   Flutter                             0x0000000102ec5a64 _ZN7flutter10Rasterizer4DrawEN3fml6RefPtrINS_8PipelineINS_9LayerTreeEEEEE + 408
9   Flutter                             0x0000000102ecc2b0 _ZNSt3__110__function6__funcIZN7flutter5Shell14OnAnimatorDrawEN3fml6RefPtrINS2_8PipelineINS2_9LayerTreeEEEEENS4_9TimePointEE4$_30NS_9allocatorISB_EEFvvEEclEv + 100
10  Flutter                             0x0000000102bf9fe8 _ZN3fml15MessageLoopImpl10FlushTasksENS_9FlushTypeE + 1472
11  Flutter                             0x0000000102bfc714 _ZN3fml17MessageLoopDarwin11OnTimerFireEP16__CFRunLoopTimerPS0_ + 32
12  CoreFoundation                      0x0000000191ac4274 50CF3336-313F-3A7D-9048-CB1ED8EC3368 + 692852
13  CoreFoundation                      0x0000000191ac3f90 50CF3336-313F-3A7D-9048-CB1ED8EC3368 + 692112
14  CoreFoundation                      0x0000000191ac366c 50CF3336-313F-3A7D-9048-CB1ED8EC3368 + 689772
15  CoreFoundation                      0x0000000191abe67c 50CF3336-313F-3A7D-9048-CB1ED8EC3368 + 669308
16  CoreFoundation                      0x0000000191abdce8 CFRunLoopRunSpecific + 424
17  Flutter                             0x0000000102bfc5f0 _ZN3fml17MessageLoopDarwin3RunEv + 88
18  Flutter                             0x0000000102bfb7cc _ZNSt3__114__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEZN3fml6ThreadC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEE3$_0EEEEEPvSJ_ + 196
19  libsystem_pthread.dylib             0x000000019185bd98 _pthread_start + 156
20  libsystem_pthread.dylib             0x000000019185f74c thread_start + 8
2020-10-19 12:20:48.429518-0400 Runner[15100:4349740] [reports] Main Thread Checker: UI API called on a background thread: -[UIView removeFromSuperview]
PID: 15100, TID: 4349740, Thread name: io.flutter.1.raster, Queue name: com.apple.root.default-qos.overcommit, QoS: 0
Backtrace:
4   Flutter                             0x0000000102bd5c70 _ZN7flutter30FlutterPlatformViewsController11SubmitFrameEP15GrDirectContextNSt3__110shared_ptrINS_10IOSContextEEENS3_10unique_ptrINS_12SurfaceFrameENS3_14default_deleteIS8_EEEE + 4932
5   Flutter                             0x0000000102bef100 _ZN7flutter10IOSSurface11SubmitFrameEP15GrDirectContextNSt3__110unique_ptrINS_12SurfaceFrameENS3_14default_deleteIS5_EEEE + 160
6   Flutter                             0x0000000102ec5764 _ZN7flutter10Rasterizer13DrawToSurfaceERNS_9LayerTreeE + 604
7   Flutter                             0x0000000102ec62a0 _ZNSt3__110__function6__funcIZN7flutter10Rasterizer4DrawEN3fml6RefPtrINS2_8PipelineINS2_9LayerTreeEEEEEE3$_1NS_9allocatorISA_EEFvNS_10unique_ptrIS7_NS_14default_deleteIS7_EEEEEEclEOSG_ + 116
8   Flutter                             0x0000000102ec5a64 _ZN7flutter10Rasterizer4DrawEN3fml6RefPtrINS_8PipelineINS_9LayerTreeEEEEE + 408
9   Flutter                             0x0000000102ecc2b0 _ZNSt3__110__function6__funcIZN7flutter5Shell14OnAnimatorDrawEN3fml6RefPtrINS2_8PipelineINS2_9LayerTreeEEEEENS4_9TimePointEE4$_30NS_9allocatorISB_EEFvvEEclEv + 100
10  Flutter                             0x0000000102bf9fe8 _ZN3fml15MessageLoopImpl10FlushTasksENS_9FlushTypeE + 1472
11  Flutter                             0x0000000102bfc714 _ZN3fml17MessageLoopDarwin11OnTimerFireEP16__CFRunLoopTimerPS0_ + 32
12  CoreFoundation                      0x0000000191ac4274 50CF3336-313F-3A7D-9048-CB1ED8EC3368 + 692852
13  CoreFoundation                      0x0000000191ac3f90 50CF3336-313F-3A7D-9048-CB1ED8EC3368 + 692112
14  CoreFoundation                      0x0000000191ac366c 50CF3336-313F-3A7D-9048-CB1ED8EC3368 + 689772
15  CoreFoundation                      0x0000000191abe67c 50CF3336-313F-3A7D-9048-CB1ED8EC3368 + 669308
16  CoreFoundation                      0x0000000191abdce8 CFRunLoopRunSpecific + 424
17  Flutter                             0x0000000102bfc5f0 _ZN3fml17MessageLoopDarwin3RunEv + 88
18  Flutter                             0x0000000102bfb7cc _ZNSt3__114__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEZN3fml6ThreadC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEE3$_0EEEEEPvSJ_ + 196
19  libsystem_pthread.dylib             0x000000019185bd98 _pthread_start + 156
20  libsystem_pthread.dylib             0x000000019185f74c thread_start + 8
2020-10-19 12:20:57.149052-0400 Runner[15100:4349581] [ProcessSuspension] 0x11cee10b0 - ProcessAssertion::processAssertionWasInvalidated()
2020-10-19 12:20:57.212890-0400 Runner[15100:4349739] flutter: allowing navigation to NavigationRequest(url: https://www.bravenewlook.com/, isForMainFrame: true)
2020-10-19 12:20:57.217222-0400 Runner[15100:4349739] flutter: Page started loading: https://www.bravenewlook.com/
2020-10-19 12:20:57.845044-0400 Runner[15100:4349739] flutter: allowing navigation to NavigationRequest(url: https://vars.hotjar.com/box-469cf41adb11dc78be68c1ae7f9457a4.html, isForMainFrame: false)
2020-10-19 12:20:57.945200-0400 Runner[15100:4349895] [assertion] Error acquiring assertion: <NSError: 0x2828814d0; domain: RBSAssertionErrorDomain; code: 2; reason: "Client is missing required entitlement"> {
    userInfo = {
        RBSAssertionAttribute = <RBSLegacyAttribute: 0x14ff3c5a0; requestedReason: FinishTaskUnbounded; reason: FinishTaskUnbounded; flags: PreventTaskSuspend>;
    }
}
2020-10-19 12:20:57.945264-0400 Runner[15100:4349895] [ProcessSuspension]  0x11ced9a40 - ProcessAssertion() PID 15100 Unable to acquire assertion for process with PID 15107
2020-10-19 12:20:57.945305-0400 Runner[15100:4349581] [ProcessSuspension] 0x11ced9a40 - ProcessAssertion::processAssertionWasInvalidated()
2020-10-19 12:20:57.946277-0400 Runner[15100:4349895] [assertion] Error acquiring assertion: <NSError: 0x282839830; domain: RBSAssertionErrorDomain; code: 2; reason: "Client is missing required entitlement"> {
    userInfo = {
        RBSAssertionAttribute = <RBSLegacyAttribute: 0x14ff57680; requestedReason: FinishTaskUnbounded; reason: FinishTaskUnbounded; flags: PreventTaskSuspend>;
    }
}
2020-10-19 12:20:57.946373-0400 Runner[15100:4349895] [ProcessSuspension]  0x11ced9a68 - ProcessAssertion() PID 15100 Unable to acquire assertion for process with PID 15100
2020-10-19 12:20:57.946413-0400 Runner[15100:4349581] [ProcessSuspension] 0x11ced9a68 - ProcessAssertion::processAssertionWasInvalidated()
2020-10-19 12:20:57.947505-0400 Runner[15100:4349895] [assertion] Error acquiring assertion: <NSError: 0x282891680; domain: RBSAssertionErrorDomain; code: 2; reason: "Client is missing required entitlement"> {
    userInfo = {
        RBSAssertionAttribute = <RBSLegacyAttribute: 0x1518a0510; requestedReason: FinishTaskUnbounded; reason: FinishTaskUnbounded; flags: PreventTaskSuspend>;
    }
}
2020-10-19 12:20:57.947620-0400 Runner[15100:4349895] [ProcessSuspension]  0x11ced9a90 - ProcessAssertion() PID 15100 Unable to acquire assertion for process with PID 15106
2020-10-19 12:20:57.947712-0400 Runner[15100:4349581] [ProcessSuspension] 0x11ced9a90 - ProcessAssertion::processAssertionWasInvalidated()
2020-10-19 12:20:57.966176-0400 Runner[15100:4349739] flutter: allowing navigation to NavigationRequest(url: about:blank, isForMainFrame: false)
2020-10-19 12:20:57.998462-0400 Runner[15100:4349739] flutter: allowing navigation to NavigationRequest(url: https://bnl.attn.tv/creative?v=1.0.903&r=&w=414&h=660&id=fb76c0ba76b249459fb6eacff78f39c5&l=https%3A%2F%2Fwww.bravenewlook.com%2F&ss_ref=ORGANIC&t=n&pv=5, isForMainFrame: false)
2020-10-19 12:20:58.075263-0400 Runner[15100:4349739] flutter: allowing navigation to NavigationRequest(url: https://gum.criteo.com/syncframe?topUrl=www.bravenewlook.com#%7B%22bundle%22:%7B%22origin%22:0,%22value%22:null%7D,%22cw%22:true,%22lwid%22:%7B%22origin%22:0,%22value%22:null%7D,%22optout%22:%7B%22origin%22:0,%22value%22:null%7D,%22origin%22:%22onetag%22,%22pm%22:0,%22sid%22:%7B%22origin%22:0,%22value%22:null%7D,%22tld%22:%22bravenewlook.com%22,%22topUrl%22:%22www.bravenewlook.com%22,%22uid%22:null,%22version%22:%225_6_2%22%7D, isForMainFrame: false)
2020-10-19 12:20:58.264607-0400 Runner[15100:4349739] flutter: allowing navigation to NavigationRequest(url: about:blank, isForMainFrame: false)
2020-10-19 12:20:58.292663-0400 Runner[15100:4349895] [assertion] Error acquiring assertion: <NSError: 0x282839fb0; domain: RBSAssertionErrorDomain; code: 2; reason: "Client is missing required entitlement"> {
    userInfo = {
        RBSAssertionAttribute = <RBSLegacyAttribute: 0x14ff523f0; requestedReason: FinishTaskUnbounded; reason: FinishTaskUnbounded; flags: PreventTaskSuspend>;
    }
}
2020-10-19 12:20:58.292801-0400 Runner[15100:4349895] [ProcessSuspension]  0x11ceda6c0 - ProcessAssertion() PID 15100 Unable to acquire assertion for process with PID 15107
2020-10-19 12:20:58.292904-0400 Runner[15100:4349581] [ProcessSuspension] 0x11ceda6c0 - ProcessAssertion::processAssertionWasInvalidated()
2020-10-19 12:20:58.293892-0400 Runner[15100:4349895] [assertion] Error acquiring assertion: <NSError: 0x282894d80; domain: RBSAssertionErrorDomain; code: 2; reason: "Client is missing required entitlement"> {
    userInfo = {
        RBSAssertionAttribute = <RBSLegacyAttribute: 0x14ff20970; requestedReason: FinishTaskUnbounded; reason: FinishTaskUnbounded; flags: PreventTaskSuspend>;
    }
}
2020-10-19 12:20:58.293941-0400 Runner[15100:4349895] [ProcessSuspension]  0x11ceda6e8 - ProcessAssertion() PID 15100 Unable to acquire assertion for process with PID 15100
2020-10-19 12:20:58.293981-0400 Runner[15100:4349581] [ProcessSuspension] 0x11ceda6e8 - ProcessAssertion::processAssertionWasInvalidated()
2020-10-19 12:20:58.294805-0400 Runner[15100:4349895] [assertion] Error acquiring assertion: <NSError: 0x28288de30; domain: RBSAssertionErrorDomain; code: 2; reason: "Client is missing required entitlement"> {
    userInfo = {
        RBSAssertionAttribute = <RBSLegacyAttribute: 0x14ff3e950; requestedReason: FinishTaskUnbounded; reason: FinishTaskUnbounded; flags: PreventTaskSuspend>;
    }
}
2020-10-19 12:20:58.294841-0400 Runner[15100:4349895] [ProcessSuspension]  0x11ceda710 - ProcessAssertion() PID 15100 Unable to acquire assertion for process with PID 15106
2020-10-19 12:20:58.294875-0400 Runner[15100:4349581] [ProcessSuspension] 0x11ceda710 - ProcessAssertion::processAssertionWasInvalidated()
2020-10-19 12:20:58.316560-0400 Runner[15100:4349739] flutter: allowing navigation to NavigationRequest(url: about:blank, isForMainFrame: false)
2020-10-19 12:20:58.319967-0400 Runner[15100:4349739] flutter: allowing navigation to NavigationRequest(url: https://tr.snapchat.com/p, isForMainFrame: false)
2020-10-19 12:20:58.322485-0400 Runner[15100:4349739] flutter: allowing navigation to NavigationRequest(url: about:blank, isForMainFrame: false)
2020-10-19 12:20:58.373353-0400 Runner[15100:4349739] flutter: allowing navigation to NavigationRequest(url: https://cdn.jst.ai/store_4.1.html?v=3.61#C9526EF5-6085-40D9-BA43-C16F464F31A9%7Cd92cd6dd-1171-11eb-bdb2-f7d1806af3a0%7C%7C%7C, isForMainFrame: false)
2020-10-19 12:20:58.581753-0400 Runner[15100:4349739] flutter: allowing navigation to NavigationRequest(url: https://cdn.jst.ai/store_4.1.html?v=3.61#C9526EF5-6085-40D9-BA43-C16F464F31A9%7Cd92cd6dd-1171-11eb-bdb2-f7d1806af3a0%7C%7C%7C, isForMainFrame: false)
2020-10-19 12:20:58.676817-0400 Runner[15100:4349739] flutter: allowing navigation to NavigationRequest(url: about:blank, isForMainFrame: false)
2020-10-19 12:20:58.681389-0400 Runner[15100:4349739] flutter: allowing navigation to NavigationRequest(url: https://www.facebook.com/v3.3/plugins/messenger_checkbox.php?allow_login=false&app_id=435291730178743&channel=https%3A%2F%2Fstaticxx.facebook.com%2Fx%2Fconnect%2Fxd_arbiter%2F%3Fversion%3D46%23cb%3Dfec5a23647e418%26domain%3Dwww.bravenewlook.com%26origin%3Dhttps%253A%252F%252Fwww.bravenewlook.com%252Ff2cd5799cd7894%26relation%3Dparent.parent&container_width=0&locale=en_US&messenger_app_id=435291730178743&origin=https%3A%2F%2Fwww.bravenewlook.com&page_id=1136781033034012&sdk=joey&user_ref=shopmsg-test-1603124458649, isForMainFrame: false)
2020-10-19 12:20:59.059736-0400 Runner[15100:4349739] flutter: Page finished loading: https://www.bravenewlook.com/
2020-10-19 12:21:05.729080-0400 Runner[15100:4349581] Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service
2020-10-19 12:21:05.729742-0400 Runner[15100:4349581] Could not signal service com.apple.WebKit.Networking: 113: Could not find specified service
2020-10-19 12:21:16.447509-0400 Runner[15100:4349581] Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service
2020-10-19 12:21:16.452800-0400 Runner[15100:4349581] Could not signal service com.apple.WebKit.Networking: 113: Could not find specified service

Logs
[✓] Flutter (Channel stable, 1.22.2, on Mac OS X 10.15.6 19G73, locale en-US)
    • Flutter version 1.22.2 at /Users/xxxx/Developer/flutter
    • Framework revision 84f3d28555 (4 days ago), 2020-10-15 16:26:19 -0700
    • Engine revision b8752bbfff
    • Dart version 2.10.2

 
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/xxxx/Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.0.1, Build version 12A7300
    • CocoaPods version 1.9.3

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 49.0.2
    • Dart plugin version 193.7547
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] Connected device (2 available)
    • XXXX’s iPhone (mobile)     • d023e150d07d2cf5ac85e62df210f2f9585264cc • ios • iOS 13.5
    • iPhone 11 Pro Max (mobile) • D9A36B11-B881-41DF-B8BE-FDCB63A8F353     • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-0 (simulator)

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions