We have a simple use case of presenting view controller that contains a single web view showing various remotely fetched web content that we are not in full control of. This is a web browser kind of screen.
Native screen is trivial, but web content can be anything.
Starting with iOS 11.3 Betas we experience frequent WebThread crashes that happen on view controller dismissal, UIWebView object deallocation.
It seems the crash depends on the actual web content loaded into the web view at that time, probably crashes in 100 % instances of that kind of content, and the same content hits millions of app installs in production without a single crash of that kind in any released iOS version.
We have captured two stack traces related to the web view deallcation crash:
#1
Crashed: WebThread
0 WebCore 0x18ed95f4c WebCore::Page::sessionID() const + 162
1 WebKitLegacy 0x18f46a68c WebFrameNetworkingContext::storageSession() const + 24
2 WebCore 0x18e375848 WebCore::ResourceHandle::willSendRequest(WebCore::ResourceRequest&&, WebCore::ResourceResponse&&, ***::CompletionHandler<void (WebCore::ResourceRequest&&)>&&) + 1012
3 WebCore 0x18e37a758 ***::Function<void ()>::CallableWrapper<-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]::$_1>::call() + 208
4 JavaScriptCore 0x18c821314 ***::dispatchFunctionsFromMainThread() + 344
5 Foundation 0x185f63c50 __NSThreadPerformPerform + 340
6 CoreFoundation 0x1854cd9e4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
7 CoreFoundation 0x1854cd20c __CFRunLoopDoSources0 + 276
8 CoreFoundation 0x1854cad7c __CFRunLoopRun + 1204
9 CoreFoundation 0x1853eb488 CFRunLoopRunSpecific + 552
10 WebCore 0x18de02a88 RunWebThread(void*) + 592
11 libsystem_pthread.dylib 0x18514f220 _pthread_body + 272
12 libsystem_pthread.dylib 0x18514f110 _pthread_body + 290
13 libsystem_pthread.dylib 0x18514db10 thread_start + 4
#2
Crashed: WebThread
0 WebCore 0x18daf9f4c WebCore::Page::setVisitedLinkStore(***::Ref<WebCore::VisitedLinkStore, ***::DumbPtrTraits<WebCore::VisitedLinkStore> >&&) + 162
1 WebKitLegacy 0x18e1ce68c <redacted> + 24
2 WebCore 0x18d0d9848 <redacted> + 1012
3 WebCore 0x18d0de758 <redacted> + 208
4 JavaScriptCore 0x18b585314 <redacted> + 344
5 Foundation 0x184cc7c50 <redacted> + 340
6 CoreFoundation 0x1842319e4 <redacted> + 24
7 CoreFoundation 0x18423120c <redacted> + 276
8 CoreFoundation 0x18422ed7c <redacted> + 1204
9 CoreFoundation 0x18414f488 CFRunLoopRunSpecific + 552
10 WebCore 0x18cb66a88 <redacted> + 592
11 libsystem_pthread.dylib 0x183eb3220 <redacted> + 272
12 libsystem_pthread.dylib 0x183eb3110 _pthread_start + 290
13 libsystem_pthread.dylib 0x183eb1b10 thread_start + 4
Only hint we have at the moment about the specifics of the web content loaded in crashing iOS 11.3 Betas web views is that:
"It has some JavaScript HTTP requesting code attached to the window's unload event".
We are guessing the page trying to request something from the network as the webview is being destroyed is causing some WebKit internal crash in iOS 11.3.