UIWebView Deallocation Crashes in iOS 11.3 Betas

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.

Replies

Are there any suggested workarounds to this issue?

I am also interested in that.

Is it something we can expect to be fixed in next iOS 11.3 beta or there is any workaround for the issue?

Any updates if this was fixed in the latest iOS 11.3 beta 6 or if it's still reproducible on your side?

Any updates? Can anyone help? We have crashed after the relase of the official 11.3 release!

I'm also getting both setVisitedLinkStore and sessionID crashes with my 11.3 users in production, but I don't have any javascript/html that can reproduce it locally. Do any of you have html/javascript that can reproduce this reliably?

Filed bug report # 39348203 with a test case - hope this gets fixed in 11.3.1!

try to set WebView delegate auf NULL on viewWillDisappear and/or event set WebView to NULL (e.g. in viewDidDisappear)

We are experiencing the same crashes in our Apps, we have been able to reproduce the issue and we have seen that the use of WKWebView instead of UIWebView prevents the App from crashing. However in our case the UIWebView is in an external advertising library and we can't change it, maybe you can. I think that our only chance is that the owner of the SDK changes the UIWebView for a WKWebView or that Apple fix the bug in the deprecated UIWebView implementation.

Hope it helps.

My bug submission got marked as a duplicate of 38191749, which I don't have access to see, but I take it as a very good thing because it means this crash is being looked at and hopefully is in the pipeline to get fixed soon.

Where are you report your crash bug ? I have some similar crash on 11.3. Any ideas about it ? https://forums.developer.apple.com/message/307349#307349

Am I crazy or is this fixed in iOS 11.4b2? My test case doesn't crash anymore after updating, when testing on the same device where it crashed with iOS 11.3. But I'm hesitant to call this fixed as I can't make my test case crash on a different device with 11.3 which it should...


Anybody else tried 11.4b2?

Has this crash gone down with 11.3.1? I am not seeing it crash on 11.3.1 yet and we had thousands of crashes on 11.3

My test case crashes on 11.3 and 11.3.1, and doesn't crash on 11.4b2.