iOS12 WKWebView WebProcessProxy Crash

Our iOS application contains WKWebView.

Recently crashes occured in iOS 12, we found this type of crash is unrelated to device type and network type.

Here is the crash report.


Thread 11 Crashed:

0 WebKit WebKit::WebProcessProxy::~WebProcessProxy() + 784

1 WebKit WebKit::WebProcessProxy::~WebProcessProxy() + 780

2 WebKit WebKit::WebProcessProxy::~WebProcessProxy() + 12

3 WebKit WebKit::WebPageProxy::~WebPageProxy() + 1692

4 WebKit -[WKObject dealloc] + 36

5 WebKit API::FrameInfo::~FrameInfo() + 48

6 WebKit -[WKFrameInfo dealloc] + 36

7 WebKit API::NavigationAction::~NavigationAction() + 188

8 WebKit -[WKNavigationAction dealloc] + 36

9 WebKit ***::BlockPtr<void (WKNavigationActionPolicy)> ***::BlockPtr<void (WKNavigationActionPolicy)>::fromCallable<WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction(WebKit::WebPageProxy&, ***::Ref<API::NavigationAction, ***::DumbPtrTraits<API::NavigationAction> >&&, ***::Ref<WebKit::WebFramePolicyListenerProxy, ***::DumbPtrTraits<WebKit::WebFramePolicyListenerProxy> >&&, API::Object*)::$_2>(WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction(WebKit::WebPageProxy&, ***::Ref<API::NavigationAction, ***::DumbPtrTraits<API::NavigationAction> >&&, ***::Ref<WebKit::WebFramePolicyListenerProxy, ***::DumbPtrTraits<WebKit::WebFramePolicyListenerProxy> >&&, API::Object*)::$_2)::'lambda'(void const*)::__invoke(void const*) + 88

10 libsystem_blocks.dylib _Block_release + 152

11 libsystem_blocks.dylib _Block_release + 152

12 libsystem_blocks.dylib _Block_release + 152

13 libdispatch.dylib _dispatch_client_callout + 16

14 libdispatch.dylib _dispatch_queue_override_invoke + 680

15 libdispatch.dylib _dispatch_root_queue_drain + 376

16 libdispatch.dylib _dispatch_worker_thread2 + 128

17 libsystem_pthread.dylib _pthread_wqthread + 472

Replies

We are almost solving the problem.

Please post what the solution was if you find it. I am seeing the same.

Could you give me some ideas?

We have solved the problem and here is the solution.


WebKit for iOS 12 is trying to throw exception when dealloc in non-main-thread (only after iOS 12).

We are trying to do sth about WKNavigationAction and dispatch code into non-main-thread, this raised the crash.


Try to find and ensure operations about WKNavigationAction running in main thread.