Mapkit MapView VectorKit Crash on iOS13 - ios

As iOS13 release, there are more and more mapKit VectorKit crashes on the app which we are working on. We can not reproduce the crash internally and there are over 200 crashes collected by our own crash reporter everyday.
From all the information we have got, the crash always happens when the application come to active from background, and at that time, the ViewController view has a MKMapView subview. Maybe something wrong when the system rendering the map UI.
This problem seems a long-lasting iOS problem since iOS11 or even earlier. Now, The crash related iOS13 system version includes 13.0, 13.1, 13.1.1, 13.1.2. I have reported the problem on the Apple bug report system, but no any response from Apple until now.
Any advice or hint will be greatly appreciated.
FYI. The crash stack as below.
Exception Type: SIGABRT
Exception Codes: #0 at 0x1a8530ebc
Crashed Thread: 0
Thread 0 Crashed:
0 libsystem_kernel.dylib __pthread_kill + 8
1 libsystem_c.dylib abort + 100
2 libsystem_c.dylib __assert_rtn + 204
3 Metal MTLIOAccelCommandBufferStorageGrowSegmentList.cold.1 + 0
4 Metal MTLReportFailure + 476
5 Metal -[MTLTextureDescriptorInternal validateWithDevice:] + 2124
6 AGXMetalA11 0x00000001a85f93e8 + 64
7 VectorKit ggl::MetalResourceManager::newTexture(ggl::Texture const*) + 596
8 VectorKit ggl::MetalRenderer::prepareTexture(ggl::MetalResourceManager*, ggl::Texture const*) + 44
9 VectorKit ggl::MetalRenderer::_processQueue(ggl::RenderTarget*, ggl::RenderQueue*, id<MTLCommandBuffer>) + 3220
10 VectorKit ggl::MetalRenderer::_processQueue(ggl::RenderTarget*, ggl::RenderQueue*, id<MTLCommandBuffer>) + 96
11 VectorKit invocation function for block in ggl::MetalRenderer::frame(ggl::RenderTarget*, ggl::RenderQueue*, std::__1::function<void ()>, std::__1::function<void ()>) + 56
12 VectorKit invocation function for block in geo::TaskQueue::sync(std::__1::function<void ()>) + 60
13 libdispatch.dylib _dispatch_client_callout + 16
14 libdispatch.dylib _dispatch_async_and_wait_invoke_and_complete_recurse + 228
15 libdispatch.dylib _dispatch_async_and_wait_f + 100
16 VectorKit ggl::MetalRenderer::frame(ggl::RenderTarget*, ggl::RenderQueue*, std::__1::function<void ()>, std::__1::function<void ()>) + 544
17 VectorKit ggl::RenderFrame::execute(ggl::RenderTarget*, ggl::RenderQueue*, std::__1::function<void ()>, std::__1::function<void ()>) + 120
18 VectorKit -[MDDisplayLayer drawToTexture:withRenderQueue:completionHandler:] + 348
19 VectorKit -[MetalLayer _onTimerFired:withPresent:] + 280
20 VectorKit md::MapEngine::renderScene(double, std::__1::function<void ()>) + 104
21 VectorKit md::MapEngine::onRenderTimerFired(double) + 328
22 VectorKit ggl::DisplayLink::onTimerFired(double) + 40
23 VectorKit -[_GGLDisplayLinkTarget displayLinkFired:] + 84
24 QuartzCore CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 632
25 QuartzCore display_timer_callback(__CFMachPort*, void*, long, void*) + 264
26 CoreFoundation __CFMachPortPerform + 172
27 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 56
28 CoreFoundation __CFRunLoopDoSource1 + 444
29 CoreFoundation __CFRunLoopRun + 2168
30 CoreFoundation CFRunLoopRunSpecific + 464
31 GraphicsServices GSEventRunModal + 104
32 UIKitCore UIApplicationMain + 1936
33 homebrew main (main.m:16)
34 libdyld.dylib start + 4

Check your CPU utilization on iOS12 vs iOS13.
I noticed that my app was crashing because I was adding and removing polylines to the map too frequently (although this problem only manifested in iOS13, not iOS12).
See my SO post about this here.
Look at your crash logs and see if you spot something like this:
Event: cpu usage
Action taken: Process killed
CPU: 48 seconds cpu time over 54 seconds (88% cpu average), exceeding limit of 80% cpu over 60 seconds
CPU limit: 48s
Limit duration: 60s
CPU used: 48s
Duration: 54.45s
Steps: 15
My app stopped crashing in iOS13 if I reduced the frequency for redrawing the map overlays.

Related

-[EAGLContext presentRenderbuffer:] crash in iOS 14

We encountered an OpenGL related crash on ios14. It has nothing to do with the application background. The vast majority of crashes occurred on IOS 14 low-end devices, and it is not clear how to solve them.
The only possible clue is that the crash may have something to do with opening the WebView.
Monitor Type: Unix Signal
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000 at 0x00000001c7517414
Crashed Thread: 0
Pthread id: 10322737
Thread 0 Crashed:
0 libsystem_kernel.dylib __pthread_kill + 8
1 libsystem_pthread.dylib pthread_kill + 272
2 libsystem_c.dylib abort + 104
3 AppleMetalGLRenderer GLDContextRec::flushContextInternal() + 852
4 GLEngine gliPresentViewES_Exec + 188
5 OpenGLES -[EAGLContext presentRenderbuffer:] + 76
6 myapp -[EJCanvasContextWebGLScreen present] (EJCanvasContextWebGLScreen.m:142)
7 QuartzCore CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 664
8 QuartzCore display_timer_callback(__CFMachPort*, void*, long, void*) + 280
9 CoreFoundation __CFMachPortPerform + 176
10 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 60
11 CoreFoundation __CFRunLoopDoSource1 + 596
12 CoreFoundation __CFRunLoopRun + 2360
13 CoreFoundation CFRunLoopRunSpecific + 600
14 GraphicsServices GSEventRunModal + 164
15 UIKitCore -[UIApplication _run] + 1072
16 UIKitCore UIApplicationMain + 168
17 myapp main (main.m:36)
18 libdyld.dylib start + 4
I'm 100% sure presentRenderBuffer works fine in iOS14.
According to the error message, it seems like a thread issue.
In my case, I use a queue to detail with all of the OpenGL things.
dispatch_sync(queue, ^{
// All of the OpenGL things
[self bindCurrentRenderBuffer];
[self presentRenderBuffer];
});
You can see my OpenGL project in Github: IRPlayer

iOS Crash GameObject::IsActive() const

I found XCode Organizer Crash Report many crashes.The Top is Following:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000156
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [0]
Triggered by Thread: 0
Thread 0 name:
Thread 0 Crashed:
0 ios 0x000000010107e9bc GameObject::IsActive() const + 16 (GameObject.cpp:425)
1 ios 0x00000001013bb168 UI::CanvasManager::AddDirtyRenderer(UI::Canvas*, UI::CanvasRenderer*) + 36 (GameObject.h:575)
2 ios 0x00000001013bba08 UI::CanvasRenderer::SetMesh(Mesh*) + 440 (CanvasRenderer.cpp:572)
3 ios 0x000000010142b32c CanvasRenderer_CUSTOM_SetMesh(Il2CppObject*, Il2CppObject*) + 68 (CanvasRendererBindings.gen.cpp:296)
4 ios 0x0000000100b515cc Graphic_DoMeshGeneration_m2913299565 + 988 (Bulk_UnityEngine.UI_0.cpp:27200)
5 ios 0x0000000100b50c98 Graphic_Rebuild_m2617722358 + 92 (GeneratedVirtualInvokers.h:25)
6 ios 0x0000000100b458bc CanvasUpdateRegistry_PerformUpdate_m2200492017 + 904 (Bulk_UnityEngine.UI_0.cpp:18024)
7 ios 0x0000000100f02854 RuntimeInvoker_Void_t1841601450(MethodInfo const*, void*, void**) + 28 (Il2CppInvokerTable.cpp:3647)
8 ios 0x0000000101962460 il2cpp::vm::Runtime::Invoke(MethodInfo const*, void*, void**, Il2CppException**) + 68 (Runtime.cpp:497)
9 ios 0x0000000101358bc8 scripting_method_invoke(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingArguments&, ScriptingExc... + 100 (ScriptingApi_Il2Cpp.cpp:213)
10 ios 0x00000001013516e0 ScriptingInvocation::Invoke(ScriptingExceptionPtr*, bool) + 60 (ScriptingInvocation.cpp:303)
11 ios 0x00000001013bb45c UI::CanvasManager::WillRenderCanvases() + 60 (ScriptingInvocation.h:71)
12 ios 0x0000000101253010 PlayerLoop() + 1036 (PlayerLoop.cpp:197)
13 ios 0x00000001014cfc54 UnityPlayerLoopImpl(bool) + 32 (LibEntryPoint.mm:221)
14 ios 0x000000010008268c UnityRepaint + 140 (UnityAppController+Rendering.mm:268)
15 ios 0x0000000100082578 -[UnityAppController(Rendering) repaintDisplayLink] + 88 (UnityAppController+Rendering.mm:77)
16 QuartzCore 0x000000018a222f24 CA::Display::DisplayLinkItem::dispatch(unsigned long long) + 44 (CADisplay.mm:1899)
17 QuartzCore 0x000000018a222dd0 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 444 (CADisplay.mm:1334)
18 IOKit 0x000000018723a094 IODispatchCalloutFromCFMessage + 372 (IOKitLib.c:1190)
19 CoreFoundation 0x0000000186f62e50 __CFMachPortPerform + 180 (CFMachPort.c:682)
20 CoreFoundation 0x0000000186f7b218 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 56 (CFRunLoop.c:1959)
21 CoreFoundation 0x0000000186f7a9cc __CFRunLoopDoSource1 + 436 (CFRunLoop.c:2078)
22 CoreFoundation 0x0000000186f784b0 __CFRunLoopRun + 1840 (CFRunLoop.c:3028)
23 CoreFoundation 0x0000000186ea62b8 CFRunLoopRunSpecific + 444 (CFRunLoop.c:3113)
24 GraphicsServices 0x000000018895a198 GSEventRunModal + 180 (GSEvent.c:2245)
25 UIKit 0x000000018ceed7fc -[UIApplication _run] + 684 (UIApplication.m:2650)
26 UIKit 0x000000018cee8534 UIApplicationMain + 208 (UIApplication.m:4092)
27 ios 0x000000010007c690 main + 160 (main.mm:33)
28 libdyld.dylib 0x0000000185e895b8 start + 4
I search for a few days but have no idea.
Environment:
Unity 5.6.4p1
Xcode 11.3
il2cpp
Devices:
iPhone 6
iPhone 6s
iPhone 6p
iPhone 7
iPad 5
iPad 6
also a little parts on iPhone XS、XS Max
iOS version:
9-13.x
I can't reproduce on local device, so can't confirm wether it's fixed.
Hope someone can help.
This looks like a bug (DISABLING UI CRASHES AT GAMEOBJECT::ISACTIVE), try to upgrade Unity to the latest stable version.

OpenGLES -[EAGLContext presentRenderbuffer:] crash in iOS9 (SpriteKit)

I am having a lot of Sprite Kit crashes in iOS 9. The below are logs I am getting. I don't think this has anything to do with my code and seems more like a SpriteKit bug in iOS 9. Anyone else faced the same issue and resolved yet?
Thread : Crashed: com.apple.main-thread
0 libmetal_timestamp.dylib 0x2ca73322 (Missing)
1 libmetal_timestamp.dylib 0x2ca73e13 (Missing)
2 RawCamera 0x226b068d (Missing)
3 OpenAL 0x2685a17f (Missing)
4 OpenAL 0x2685a0b3 (Missing)
5 OpenGLES 0x26865079 -[EAGLContext presentRenderbuffer:] + 60
6 Jet 0x2dc85eb7 jet_context_OpenGL::present(std::__1::shared_ptr<jet_texture> const&, double) + 290
7 SpriteKit 0x280ec63d SKCRenderer::render(SKCNode*, float vector[4], std::__1::shared_ptr<jet_framebuffer> const&, unsigned int vector[4], matrix_float4x4, bool, NSDictionary*, SKCStats*, SKCStats*) + 1644
8 SpriteKit 0x28089a7f __51-[SKView _vsyncRenderForTime:preRender:postRender:]_block_invoke + 998
9 SpriteKit 0x28089d59 __51-[SKView _vsyncRenderForTime:preRender:postRender:]_block_invoke196 + 300
10 SpriteKit 0x280895e1 -[SKView _vsyncRenderForTime:preRender:postRender:] + 440
11 SpriteKit 0x2808b15b __29-[SKView setUpRenderCallback]_block_invoke + 118
12 SpriteKit 0x280bc1fb -[SKDisplayLink _callbackForNextFrame:] + 58
13 QuartzCore 0x27afe85f CA::Display::DisplayLinkItem::dispatch() + 106
14 QuartzCore 0x27afe6af CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 594
15 IOMobileFramebuffer 0x2db8b58b IOMobileFramebufferVsyncNotifyFunc + 86
16 IOKit 0x25179345 IODispatchCalloutFromCFMessage + 256
17 CoreFoundation 0x2406ab59 __CFMachPortPerform + 132
18 CoreFoundation 0x2407cf7b __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 34
19 CoreFoundation 0x2407c68f __CFRunLoopDoSource1 + 342
20 CoreFoundation 0x2407aaa1 __CFRunLoopRun + 1704
21 CoreFoundation 0x23fcd0d9 CFRunLoopRunSpecific + 516
22 CoreFoundation 0x23fccecd CFRunLoopRunInMode + 108
23 GraphicsServices 0x2d342af9 GSEventRunModal + 160
24 UIKit 0x282562dd UIApplicationMain + 144
25 jumpytiles 0x9358c main (AppDelegate.swift:17)
26 libdyld.dylib 0x35ec8873 start + 2

SecItemUpdate failed to resume in time

Upon UIApplicationDidBecomeActiveNotification, I trigger a SecItemUpdate call:
OSStatus itemError = SecItemUpdate((__bridge CFDictionaryRef)secItemSearchParams, (__bridge CFDictionaryRef)secItemNewData);
I have one device (64 bit + iOS 7) that takes about 10 seconds to evaluate this line, and it returns with no error (OSStatus = errSecSuccess).
I keep getting a 8badf00d exception ("failed to resume in time" exception, see attached call stack), so as a remedy I moved this logic out of the main thread. However I don't understand why SecItemUpdate takes so much time to evaluate! It seems like the KeyChain or some other resource is not ready.
Any clues?
Call stack:
Exception Type: 00000020
Exception Codes: 0x000000008badf00d
Highlighted Thread: 0
Application Specific Information:
com.MyApp123.MyApp123 failed to resume in time
Elapsed total CPU time (seconds): 3.670 (user 3.670, system 0.000), 15% CPU
Elapsed application CPU time (seconds): 0.022, 0% CPU
Thread 0:
0 libsystem_kernel.dylib 0x0000000193d49cdc semaphore_wait_trap + 8
1 libxpc.dylib 0x0000000193e006b0 xpc_connection_send_message_with_reply_sync + 180
2 Security 0x0000000189f1157c securityd_message_with_reply_sync + 92
3 Security 0x0000000189f21350 __SecItemUpdate_block_invoke + 300
4 Security 0x0000000189f20228 SecOSStatusWith + 28
5 Security 0x0000000189f211e0 SecItemUpdate + 136
6 MyApp123 0x000000010059472c +[WDKeyChainUtils setKeyChainData:forLabel:] (WDKeyChainUtils.m:39)
7 MyApp123 0x0000000100173e68 -[DateWatcher setLastSeenDate:] (DateWatcher.m:123)
8 MyApp123 0x0000000100173ae8 -[DateWatcher watchLogic] (DateWatcher.m:96)
9 MyApp123 0x0000000100173b68 -[DateWatcher watchOnAppBecomeActiveOrMainKeyDidBecomeAvailable:] (DateWatcher.m:101)
10 CoreFoundation 0x000000018711f5b0 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 16
11 CoreFoundation 0x000000018706c100 _CFXNotificationPost + 2060
12 Foundation 0x0000000187bfe744 -[NSNotificationCenter postNotificationName:object:userInfo:] + 68
13 UIKit 0x000000018a1b92e4 -[UIApplication _stopDeactivatingForReason:] + 424
14 UIKit 0x000000018a36161c -[UIApplication _handleApplicationResumeEvent:] + 1136
15 UIKit 0x000000018a13532c -[UIApplication handleEvent:withNewEvent:] + 1876
16 UIKit 0x000000018a134acc -[UIApplication sendEvent:] + 100
17 MyApp123 0x0000000100266738 -[WDApplication sendEvent:] (WDApplication.m:38)
18 UIKit 0x000000018a1a1040 _UIApplicationHandleEvent + 668
19 GraphicsServices 0x000000018cd53500 _PurpleEventCallback + 672
20 GraphicsServices 0x000000018cd5302c PurpleEventCallback + 44
21 CoreFoundation 0x000000018712ae8c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
22 CoreFoundation 0x000000018712adec __CFRunLoopDoSource1 + 440
23 CoreFoundation 0x0000000187129010 __CFRunLoopRun + 1616
24 CoreFoundation 0x0000000187069c1c CFRunLoopRunSpecific + 448
25 GraphicsServices 0x000000018cd51c08 GSEventRunModal + 164
26 UIKit 0x000000018a19afd8 UIApplicationMain + 1152
27 MyApp123 0x0000000100110dc8 main (main.m:17)
28 libdyld.dylib 0x0000000193c67a9c start + 0

UIWebView iOS 5 : WebKit/JavaScriptCore crash

I'm trying to include a UIWebView based browser in my iPad application. It takes some time, which makes it hard to debug, but the app finally crashes, always on the same spot: the WebThread, on the JavaScriptCore WTF::StringImpl::hash() function. It produces EXC_BAD_ACCESS (SIGSEGV), KERN_INVALID_ADDRESS at 0x00000001.
The UIWebView is inside a view controller managed by another view controller (container) in a stack-like fashion. I'm only keeping four or less of those browsers in memory.
Anything about the crash log, or about what might be causing the crash?
This is the crash log of the web thread:
Thread 2 name: WebThread
Thread 2 Crashed:
0 JavaScriptCore 0x32a97d46 WTF::StringImpl::hash() const + 42
1 JavaScriptCore 0x32a97c6a WTF::HashTable<WTF::StringImpl*, WTF::StringImpl*, WTF::IdentityExtractor<WTF::StringImpl*>, WTF::StringHash, WTF::HashTraits<WTF::StringImpl*>, WTF::HashTraits<WTF::StringImpl*> >::lookupForWriting(WTF::StringImpl* const&) + 18
2 JavaScriptCore 0x32a9b028 std::pair<WTF::HashTableIterator<WTF::StringImpl*, WTF::StringImpl*, WTF::IdentityExtractor<WTF::StringImpl*>, WTF::StringHash, WTF::HashTraits<WTF::StringImpl*>, WTF::HashTraits<WTF::StringImpl*> >, bool> WTF::HashTable<WTF::StringImpl*, WTF::StringImpl*, WTF::IdentityExtractor<WTF::StringImpl*>, WTF::StringHash, WTF::HashTraits<WTF::StringImpl*>, WTF::HashTraits<WTF::StringImpl*> >::add<WTF::StringImpl*, WTF::StringImpl*, WTF::IdentityHashTranslator<WTF::StringImpl*, WTF::StringImpl*, WTF::StringHash> >(WTF::StringImpl* const&, WTF::StringImpl* const&) + 448
3 JavaScriptCore 0x32a9ae30 WTF::AtomicString::addSlowCase(WTF::StringImpl*) + 96
4 WebCore 0x31bade0c WebCore::AtomicHTMLToken::initializeAttributes(WTF::Vector<WebCore::HTMLToken::Attribute, 10ul> const&) + 232
5 WebCore 0x31b88076 WebCore::AtomicHTMLToken::AtomicHTMLToken(WebCore::HTMLToken&) + 302
6 WebCore 0x31b87eae WebCore::HTMLTreeBuilder::constructTreeFromToken(WebCore::HTMLToken&) + 14
7 WebCore 0x31b7d07e WebCore::HTMLDocumentParser::pumpTokenizer(WebCore::HTMLDocumentParser::SynchronousMode) + 150
8 WebCore 0x31bee29a WebCore::HTMLDocumentParser::resumeParsingAfterScriptExecution() + 50
9 WebCore 0x31bc87e6 WebCore::HTMLDocumentParser::notifyFinished(WebCore::CachedResource*) + 78
10 WebCore 0x31bc7448 WebCore::CachedResource::checkNotify() + 40
11 WebCore 0x31bc7308 WebCore::CachedScript::data(WTF::PassRefPtr<WebCore::SharedBuffer>, bool) + 84
12 WebCore 0x31bc7240 WebCore::CachedResourceRequest::didFinishLoading(WebCore::SubresourceLoader*, double) + 120
13 WebCore 0x31bc715e WebCore::SubresourceLoader::didFinishLoading(double) + 158
14 WebCore 0x31bc58c2 _ZN7WebCoreL16didFinishLoadingEP16_CFURLConnectionPKv + 46
15 CFNetwork 0x347737ee URLConnectionClient::_clientDidFinishLoading(URLConnectionClient::ClientConnectionEventQueue*) + 186
16 CFNetwork 0x3476849e URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload(XConnectionEventInfo<XClientEvent, XClientEventParams>*, long) + 418
17 CFNetwork 0x3476819c URLConnectionClient::processEvents() + 100
18 CFNetwork 0x347680d2 MultiplexerSource::perform() + 150
19 CoreFoundation 0x313d2acc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 8
20 CoreFoundation 0x313d2298 __CFRunLoopDoSources0 + 208
21 CoreFoundation 0x313d103e __CFRunLoopRun + 646
22 CoreFoundation 0x3135449e CFRunLoopRunSpecific + 294
23 CoreFoundation 0x31354366 CFRunLoopRunInMode + 98
24 WebCore 0x31b74c9c _ZL12RunWebThreadPv + 396
25 libsystem_c.dylib 0x33bca72e _pthread_start + 314
26 libsystem_c.dylib 0x33bca5e8 thread_start + 0
I had the same problem, spent the whole day... There were a LOT of different WebKit errors like these. Finally, I got it: this was a multi-threaded issue! I created the WebView from thread 1, then tried to modify its contents by means of JS functions in thread 2...
The simple performSelectorOnMainThread:withObject:waitUntilDone: fixed the problem!
Maybe this will help someone.
As the crash log suggests, it looks like it might be a JavaScript related problem. I assume the page you're loading has JavaScript on it? Out of interest, does the webpage run fine in Mobile Safari - is it just in a UIWebView that you have problems?
If you're unable to modify the JS, or web page seems to run fine on other mobile/desktop browsers or devices , I would suggest filing a bug with Apple along with the JavaScript used to reproduce the problem.

Resources