WebCore OpenGL crash in web view when app with background modes enabled goes to background

Originator:jingyil
Number:rdar://31689026 Date Originated:04/18/17
Status:Open Resolved:
Product:iOS + SDK Product Version:iOS 9
Classification: Reproducible:Sometimes
 
Summary:
App running OpenGL method in web view (UIWebView or WKWebView) will crash when it goes to the background. There’s no way to stop or pause the OpenGL execution in web view before app goes to background. Setting the web view to nil doesn’t work.


Steps to Reproduce:
1. Load a web view that uses OpenGL to do animation.
2. Click on the web view to start animation.
3. Before the animation stops, click the home button to exit the app.
4. Reopen the app.


Expected Results:
No crash.


Observed Results:
App crashed.  See crash log below:

#8. Crashed: WebThread
0  libGPUSupportMercury.dylib     0x19e485f94 gpus_ReturnNotPermittedKillClient
1  AGXGLDriver                    0x1a2f451bc (null)
2  libGPUSupportMercury.dylib     0x19e486f44 gpusSubmitDataBuffers
3  AGXGLDriver                    0x1a2f4677c (null)
4  IOAccelerator                  0x190edde28 IOAccelContextFinishResourceSysMem + 64
5  libGPUSupportMercury.dylib     0x19e48b5ec gldFinishObject
6  GLEngine                       0x1a36d4948 glBufferSubData_Exec
7  WebCore                        0x194301738 WebCore::WebGLRenderingContextBase::bufferSubData(unsigned int, long long, WTF::RefPtr<JSC::ArrayBufferView>&&, int&) + 488
8  WebCore                        0x193defa9c WebCore::jsWebGLRenderingContextBasePrototypeFunctionBufferSubData(JSC::ExecState*) + 1604
9  JavaScriptCore                 0x192f7d064 llint_entry + 27476
10 JavaScriptCore                 0x192f7c5e8 llint_entry + 24792
11 JavaScriptCore                 0x192f7c5e8 llint_entry + 24792
12 JavaScriptCore                 0x192f7c5e8 llint_entry + 24792
13 JavaScriptCore                 0x192f7c5e8 llint_entry + 24792
14 JavaScriptCore                 0x192f7c5e8 llint_entry + 24792
15 JavaScriptCore                 0x192f7c5e8 llint_entry + 24792
16 JavaScriptCore                 0x192f7c5e8 llint_entry + 24792
17 JavaScriptCore                 0x192f7c5e8 llint_entry + 24792
18 JavaScriptCore                 0x192f76348 vmEntryToJavaScript + 264
19 JavaScriptCore                 0x192e48a8c JSC::JITCode::execute(JSC::VM*, JSC::ProtoCallFrame*) + 168
20 JavaScriptCore                 0x1928998e8 JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 352
21 JavaScriptCore                 0x192b0cb24 JSC::profiledCall(JSC::ExecState*, JSC::ProfilingReason, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&, WTF::NakedPtr<JSC::Exception>&) + 164
22 WebCore                        0x193ad6670 WebCore::JSCallbackData::invokeCallback(JSC::JSObject*, JSC::MarkedArgumentBuffer&, WebCore::JSCallbackData::CallbackType, JSC::PropertyName, WTF::NakedPtr<JSC::Exception>&) + 448
23 WebCore                        0x193ce9660 WebCore::JSRequestAnimationFrameCallback::handleEvent(double) + 328
24 WebCore                        0x1940a7b08 WebCore::ScriptedAnimationController::serviceScriptedAnimations(double) + 432
25 WebCore                        0x1937780ec WebCore::DisplayRefreshMonitor::displayDidRefresh() + 336
26 WebCore                        0x193778a00 -[WebDisplayLinkHandler handleDisplayLink:] + 36
27 QuartzCore                     0x191ba6f24 CA::Display::DisplayLinkItem::dispatch(unsigned long long) + 44
28 QuartzCore                     0x191ba6dd0 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 444
29 IOKit                          0x18ebbe094 IODispatchCalloutFromCFMessage + 372
30 CoreFoundation                 0x18e8e6e50 __CFMachPortPerform + 180
31 CoreFoundation                 0x18e8ff218 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 56
32 CoreFoundation                 0x18e8fe9cc __CFRunLoopDoSource1 + 436
33 CoreFoundation                 0x18e8fc4b0 __CFRunLoopRun + 1840
34 CoreFoundation                 0x18e82a2b8 CFRunLoopRunSpecific + 444
35 WebCore                        0x193430490 RunWebThread(void*) + 456
36 libsystem_pthread.dylib        0x18d9e5850 _pthread_body + 240
37 libsystem_pthread.dylib        0x18d9e5760 _pthread_body + 282
38 libsystem_pthread.dylib        0x18d9e2d94 thread_start + 4

Comments

Please fix this, while the bug was reported on iOS 9, it is also present on iOS 10 and 11.

By stephen.aldous at March 10, 2018, 1:22 p.m. (reply...)

This was opened on 4/18/2017 and is still open? How does one get an update. AdMob ads are crashing my apps as a result of this issue.

By SwiftDeveloper at March 8, 2018, 11:42 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!