crash at WebCore::FrameView::contentsSizeRespectingOverflow

Started getting this crash on iOS9 (and 9.1) from the day it was released.


Here is an example (partial) stack trace:


Exception Type: SIGSEGV

Exception Codes: SEGV_ACCERR at 0x100000057


Crashed Thread: 0


Thread 0 Crashed:

0 WebCore 0x0000000197b80128 WebCore::FrameView::contentsSizeRespectingOverflow() const + 128

1 WebKitLegacy 0x0000000198732774 -[WebView(WebPrivate) _contentsSizeRespectingOverflow] + 40

2 UIKit 0x000000018b302e88 -[UIWebDocumentView _updateSize] + 496

3 CoreFoundation 0x0000000185d471e8 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 16

4 CoreFoundation 0x0000000185d46a08 _CFXRegistrationPost + 392

5 CoreFoundation 0x0000000185d46788 ___CFXNotificationPost_block_invoke + 56

6 CoreFoundation 0x0000000185dac2cc -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1528

7 CoreFoundation 0x0000000185c87314 _CFXNotificationPost + 364

8 Foundation 0x0000000186bf245c -[NSNotificationCenter postNotificationName:object:userInfo:] + 64

9 CoreFoundation 0x0000000185da75c0 __invoking___ + 140

10 CoreFoundation 0x0000000185ca50d4 -[NSInvocation invoke] + 280

11 WebCore 0x0000000197745e04 HandleDelegateSource(void*) + 104

12 CoreFoundation 0x0000000185d590dc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 20

13 CoreFoundation 0x0000000185d58b70 __CFRunLoopDoSources0 + 536

14 CoreFoundation 0x0000000185d56870 __CFRunLoopRun + 720

15 CoreFoundation 0x0000000185c858a0 CFRunLoopRunSpecific + 380

16 GraphicsServices 0x0000000190b34088 GSEventRunModal + 176

17 UIKit 0x000000018b31a0d4 UIApplicationMain + 200

18 [Our App] 0x0000000100041f90 0x10003c000 + 24464

19 libdyld.dylib 0x000000019b00e8b8 start + 0

Seems to happen when pushing a viewcontroller that has a UIWebView onto the view stack and then making a request on it. Need to do some more work to get a proper repro.

I have not been able to find much other information on anyone having this error, or contentsSizeRespectingOverflow itself either. We are getting about 800 of these per day (usually 6000 or so sessions per day), so, quite a lot of crashes relatively...

Anyone else?

Replies

Hi,


We are also seeing this crash in production on iOS9. We have just had one instance on iOS9 but have no clue as to the steps to reproduce.

Hi, does your app do something similar to mine?


What kind of urls would you have been loading? Is your app only loading a few? Do you instantiate new webviews?


I have made a small test app that does the thing that seemed to be crashing our app:

Implement shouldStartLoadWithRequest to return NO for a request

Load and push a new ViewController with a UIWebView on it and send the request to that controller

Load the passed in url in the webview on that controller.


But it only fails when we load urls from our site into the new view. I have tried with a bunch of random urls but have not found any that fail. Also of note is that just repeatedly loading a url into a webview does not cause the problem. I can only make it happen if I create the new webview just before making the request.


We did remove one tracking script from our site and the failure rate went down from 1 in 10 or 20. To somewhere between 1 in 100 and 1 in 500. Though I have now seen the test app happily load the new webview and url over 1000 times. This is a decent heisenbug.


This is a very tricky one and if I had another failing example that would possibly be helpful.

We are getting exactly the same crash from iOS9 (9.0, 9.0.1, 9.1 beta) users. We are presenting modally a view controller which has a UIWebView inside. We call `loadRequest:` from `viewDidLoad:`, but I've also tried to load request from `viewDidAppear`. I can reproduce the crash when I'm quickly presenting and dismissing this view controller multiple times. Sometimes during running this test I'm waiting a little bit for the web page's content to actually load. Then dismiss and present again.

I have also posted here: https://bugs.webkit.org/show_bug.cgi?id=149495 and opened a bug with apple, and contacted DTS.


From feedback in the bugzilla report it does seem like it might be associated with destroying the UIWebView. I guess we have to wait to see how long a fix takes to filter though.


In the mean time I think I am going to change our app to cache the one instance of the second view controller and just re-use it rather than creating a new one each time.

Thanks for investigating this! Please keep us updated about this issue. We are going to ignore this for now.

We are also getting lots of crash reports for one of our apps in `WebCore::FrameView::contentsSizeRespectingOverflow()`.

I was not able to reproduce it. Hope it will be fixed soon in an iOS update.

Try to change a setting in WebView xib.

Scaling -> Scales Page To Fit Unchecked..

NO is already the default value of UIWebView.scalesPageToFit

Just a quick update. I have had a (pretty poor) response to my DTS ticket. Basically: "engineering is investigating" and "as beta releases become available [...] test your issue to see if it has been addressed"


So. Keep hoping that we fix it in a point release.

I am experiencing the same problem, iOS 9, swift, UIWebview presented modally. An assynchronous service is called in ViewDidAppear, the webview is loaded based on the response to this service. Crash is intermittent on the simulator...the stack trace looks the same as yours. There was one crash reported on a device which may be the same but have not obtained crash logs to confirm.


If there is any way I can help to bump up the severity of the DTS ticket based please let me know.

This backtrace has a look of one that a fix has gone into iOS 9.1 beta 4. It would be great to hear if folks reporting this issue can try it on beta 4 and see if it still happens there.

What you need to do to influence apple to spend time on this issue is log your own radar at bugreporter.apple.com - it will get marked as a duplicate, but they use the number of duplicates to rank bugs.


Apparently apple engineering are already looking into it, but another bug report can't hurt.

It may have been "fixed" by beta 4... My test code no longer crashes. The same code does however gets "Terminated due to memory issue" after about 800 or so page loads.

If there was something put in to cache the current viewport renderer, then perhaps it is not being released again?

I have a problem about UIWebView ,Seek for Helping

https://forums.developer.apple.com/message/316963#316963

Please have a look at my problem https://forums.developer.apple.com/message/316963