WKWebview OOM issues - best practices

Dear community and @eskimo


I am supporting and developing EPUB reader application which uses UIWebView for rendering EPUBs. All went smooth untill we decided to move to the WKWebview due to UIWebView depreciation in iOS12.

Our assumption is that OOM issue occurs on the old devices like iPad 2 when app is calculating content with help of WKWebView. While device is connected to a MacBook nothing appears in a debugger, connection just drops and app is terminated.

No crash reports are present. Just a line in a console log :

default 14:43:59.000000 +020204 com.apple.xpc.launchd Service exited due to signal: Killed: 9

The flow looks like this:

  1. App loads UIPageview which launches 3 ViewControllers with WKWebview.

    One for current page, another one for previous and one for next.

    Three WKWebViews in total.

  2. The same time another NSOperation starts and app goes through each html chapter making invisible rendering to calculate pages.

For some books app just terminates about 70% of progress without any info in debugger. Small books works fine.

Due to the nature of WKWebview i can’t see anything connected to it in allocation instrument.


Would you be so kind to recommend best practice how i should debug this? And some ideas about solutions?

Replies

I’m presuming that OOM stands for out of memory.

First up, detection. If you implement the

-webViewWebContentProcessDidTerminate:
navigation delegate method, does it get called?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

@eskimo
Thanks for your reply. Yeah, by OOM i mean out of memory issues.
I tried you recommendation to see whether the -webViewWebContentProcessDidTerminate: is called. And as i can see based on 5 attempts it was not called.
Would you be so kind to recommend some debug approaches here?

@eskimo
Accidentally replied from other develper profile. Sorry for confusion.

Would you be so kind to recommend some debug approaches here?

Does this reproduce on the simulator?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Simulator works fine. And this issue is also not reproducible on iPad Air 2.

OK, I had a re-read of your original email and I suspect I missed something earlier. You wrote:

For some books app just terminates about 70% of progress without any info in debugger.

So it’s your main app that’s terminating? Not one of the web kit rendering processes?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Yes, exactly, app is terminated.

Yes, exactly, app is terminated.

Thanks for confirming that.

At this point I’ve got no simple suggestions for how to proceed here. My recommendation is that you open a DTS tech support incident so that a DTS engineer, possibly even me, can help you look into this in depth.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

I just realized one possible solution which i implemented -> For devices using lower than iOS10 i am using old renderer based on UIWebview. Even if UIWebview will be completely removed later this should work for old devices.