-[EAGLContext presentRenderbuffer:] crash in iOS 14 - ios

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

Related

Crash on ios 15: CA::Display::DisplayLink::timer_status_callback

My app crashed about 200 times per month on iOS 15, and I failed to solve it.
The crash reports shows like following:
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000001f12d313c
Thread 0 Crashed:
0 libsystem_platform.dylib 0x00000001f12d313c _os_unfair_lock_corruption_abort + 88
1 libsystem_platform.dylib 0x00000001f12cda20 _os_unfair_lock_lock_slow + 320
2 QuartzCore 0x000000018441c7c4 CA::Display::DisplayTimingsControl::granularity+ 100292 (unsigned int) + 40
3 QuartzCore 0x000000018456b99c CA::Display::DisplayLink::timer_status_callback+ 1472924 (_CADisplayTimer*, CADisplayTimerAction, unsigned long long, unsigned long long, void*) + 692
4 QuartzCore 0x000000018441b678 display_timer_callback+ 95864 (__CFMachPort*, void*, long, void*) + 272
5 CoreFoundation 0x00000001806bf390 __CFMachPortPerform + 176
6 CoreFoundation 0x0000000180702724 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 60
7 CoreFoundation 0x0000000180705f30 __CFRunLoopDoSource1 + 596
8 CoreFoundation 0x00000001806bfe0c __CFRunLoopRun + 2380
9 CoreFoundation 0x00000001806d33b8 CFRunLoopRunSpecific + 600
10 GraphicsServices 0x000000019c06338c GSEventRunModal + 164
11 UIKitCore 0x00000001830736a8 0x182b5a000 + 5346984
12 UIKitCore 0x0000000182df27f4 UIApplicationMain + 2092
13 IBUWireless 0x0000000104700584 main + 17796 (main.m:44)
14 (null) 0x00000001083d9a24 0x0 + 4433222180
I guess it's because a CADisPlayLink has been dealloced wrongly, but I can't figure out which one.
The source code of apple's lock is https://github.com/apple/darwin-libplatform/blob/main/src/os/lock.c
Is Apple's CADisplayLayer Opensourced? How can I fix this crash?
This crash occurs due to a dangling pointer. When any variable or object is trying to access an object that's already been deallocated, this crash occurs.
check code and trace line by line.

Xamarin Forms: sporadic crashes since porting to WkWebView

We ported our app from UIWebView to WkWebView.
Since then the app crashes sporadically (sometimes after minutes, sometimes after hours, sometimes not at all) while being in background.
Looking at the termination reason 0x8badf00d (see crash report below) and Apple's developer documentation (Understanding and Analyzing Application Crash Reports) the crash seems to be related to a watchdog timeout.
The only task we start in our code while the app moves to background is embedded in appropriate calls to UIApplication.SharedApplication.BeginBackgroundTask and UIApplication.SharedApplication.EndBackgroundTask. That task is a network request that does not run on the main UI thread and it completes within a second.
That said I assume the crash to be related to a WebKit / JavaScriptCore issue.
Did anyone else experience such crashes (exception type EXC_BAD_ACCESS (SIGKILL) & termination reason Namespace ASSERTIOND, Code 0x8badf00d) and can provide any specific hint about how to avoid them?
Many thanks in advance & best regards!
Mario.
Incident Identifier: 2084FF7B-EDFB-41D4-849F-E03F75335214
CrashReporter Key: 0af317c4eee2f011df0e1a9fc253199241998699
Hardware Model: iPhone10,6
Process: App [1798]
Path: /private/var/containers/Bundle/Application/A4FF0F47-4ED6-4A97-8F15-E6AC432FC62D/App.app/App
Identifier: com.abc.app
Version: 7000025 (7.0.25)
Code Type: ARM-64 (Native)
Role: Non UI
Parent Process: launchd [1]
Coalition: com.abc.app [792]
Date/Time: 2019-03-20 10:15:43.9491 +0100
Launch Time: 2019-03-20 09:55:44.7537 +0100
OS Version: iPhone OS 12.1.4 (16D57)
Baseband Version: 2.02.51
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGKILL)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000
VM Region Info: 0 is not in any region. Bytes before following region: 4370874368
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
UNUSED SPACE AT START
--->
__TEXT 0000000104864000-0000000105bdc000 [ 19.5M] r-x/r-x SM=COW ...honeMobileiOS
Termination Reason: Namespace ASSERTIOND, Code 0x8badf00d
Triggered by Thread: 0
Thread 0 name: tid_303 Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x00000001841bef0c __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x0000000184241410 _pthread_cond_wait$VARIANT$armv81 + 620
2 JavaScriptCore 0x000000018b95b7d8 WTF::ThreadCondition::timedWait+ 305112 (WTF::Mutex&, WTF::WallTime) + 148
3 JavaScriptCore 0x000000018b9429a0 WTF::ParkingLot::parkConditionallyImpl(void const*, WTF::ScopedLambda<bool ()> const&, WTF::ScopedLambda<void + 203168 ()> const&, WTF::TimeWithDynamicClockType const&) + 2004
4 JavaScriptCore 0x000000018b91c2e4 bool WTF::Condition::waitUntil<WTF::Lock>+ 45796 (WTF::Lock&, WTF::TimeWithDynamicClockType const&) + 184
5 JavaScriptCore 0x000000018b920010 WTF::BinarySemaphore::wait+ 61456 (WTF::TimeWithDynamicClockType) + 112
6 WebKit 0x000000019400a2b0 IPC::Connection::waitForSyncReply+ 455344 (unsigned long long, WTF::Seconds, WTF::OptionSet<IPC::SendSyncOption>) + 276
7 WebKit 0x0000000194009af8 IPC::Connection::sendSyncMessage+ 453368 (unsigned long long, std::__1::unique_ptr<IPC::Encoder, std::__1::default_delete<IPC::Encoder> >, WTF::Seconds, WTF::OptionSet<IPC::SendSyncOption>) + 416
8 WebKit 0x00000001942cac3c bool IPC::Connection::sendSync<Messages::WebProcess::ProcessWillSuspendImminently>+ 3341372 (Messages::WebProcess::ProcessWillSuspendImminently&&, Messages::WebProcess::ProcessWillSuspendImminently::Reply&&, unsigned long long, WTF::Seconds, WTF::OptionSet<IPC::SendSyncOption>) + 176
9 WebKit 0x00000001942c5a70 bool WebKit::ChildProcessProxy::sendSync<Messages::WebProcess::ProcessWillSuspendImminently>+ 3320432 (Messages::WebProcess::ProcessWillSuspendImminently&&, Messages::WebProcess::ProcessWillSuspendImminently::Reply&&, unsigned long long, WTF::Seconds, WTF::OptionSet<IPC::SendSyncOption>) + 120
10 WebKit 0x00000001942c59e8 WebKit::WebProcessProxy::sendProcessWillSuspendImminently+ 3320296 () + 76
11 WebKit 0x0000000193fafabc -[WKProcessAssertionBackgroundTaskManager _notifyClientsOfImminentSuspension] + 72
12 WebKit 0x00000001940ea7fc __64-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]_block_invoke + 168
13 UIKitCore 0x00000001b1801a8c _fireBackgroundExpirationHandlers + 300
14 FrontBoardServices 0x0000000187057504 __69-[FBSUIApplicationWorkspace clientHandleAssertionExpirationImminent:]_block_invoke + 76
15 FrontBoardServices 0x000000018706ae94 __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 64
16 libdispatch.dylib 0x0000000184062484 _dispatch_client_callout + 16
17 libdispatch.dylib 0x00000001840393e0 _dispatch_block_invoke_direct$VARIANT$armv81 + 216
18 FrontBoardServices 0x000000018709fa9c __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 40
19 FrontBoardServices 0x000000018709f728 -[FBSSerialQueue _performNext] + 416
20 FrontBoardServices 0x000000018709fd44 -[FBSSerialQueue _performNextFromRunLoopSource] + 56
21 CoreFoundation 0x00000001845ba0e0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
22 CoreFoundation 0x00000001845ba060 __CFRunLoopDoSource0 + 88
23 CoreFoundation 0x00000001845b9944 __CFRunLoopDoSources0 + 176
24 CoreFoundation 0x00000001845b4810 __CFRunLoopRun + 1040
25 CoreFoundation 0x00000001845b40e0 CFRunLoopRunSpecific + 436
26 GraphicsServices 0x000000018682d584 GSEventRunModal + 100
27 UIKitCore 0x00000001b1804c00 UIApplicationMain + 212
28 Xamarin.Sdk 0x0000000106da9518 0x106224000 + 12080408
29 Xamarin.Sdk 0x0000000106cfac8c 0x106224000 + 11365516
30 Xamarin.Sdk 0x0000000106cfac4c 0x106224000 + 11365452
31 App 0x00000001049cf7fc App_Application_Main_string__ + 1488892 (/<unknown>:1)
32 Xamarin.Sdk 0x0000000106526bb8 0x106224000 + 3156920
33 Mono 0x0000000105fd7374 mono_jit_runtime_invoke + 904
34 Mono 0x000000010605d1a0 mono_runtime_invoke_checked + 148
35 Mono 0x0000000106063084 mono_runtime_exec_main_checked + 120
36 Mono 0x0000000105fb6c1c mono_jit_exec + 268
37 Xamarin 0x0000000105d76cc8 xamarin_main + 1132
38 App 0x00000001049c8e4c main + 1461836 (main.m:155)
39 libdyld.dylib 0x0000000184072bb4 start + 4

SIGSEGV Crash in thread 1, very small stack trace

Recently our released app have crashed several times with a stack trace that contain very little information to what the root cause can be. According to the crash log, the crash happens in thread 1, but this thread only have two calls. Could it be that the real problem is still in the main thread 0?
Could anyone suggest the best approach to find the background problem?
Hardware Model: iPhone6,2
Process: App [159]
Version: 0813 (1.3.2)
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
Date/Time: 2014-08-16 16:51:48.114 +0200
OS Version: iOS 7.1.2 (11D257)
Report Version: 104
Exception Type: EXC_CRASH (SIGSEGV)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread: 1
Thread 0:
0 libobjc.A.dylib 0x00000001924901d0 objc_msgSend + 16
1 UIKit 0x0000000189026d94 -[UITableView _updateVisibleCellsNow:] + 1748
2 UIKit 0x0000000189026610 -[UITableView layoutSubviews] + 164
3 UIKit 0x0000000188f3afdc -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 344
4 QuartzCore 0x0000000188b2c254 -[CALayer layoutSublayers] + 180
5 QuartzCore 0x0000000188b26e1c CA::Layer::layout_if_needed(CA::Transaction*) + 296
6 QuartzCore 0x0000000188b26cd4 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 28
7 QuartzCore 0x0000000188b2655c CA::Context::commit_transaction(CA::Transaction*) + 276
8 QuartzCore 0x0000000188b26300 CA::Transaction::commit() + 420
9 QuartzCore 0x0000000188b1fc34 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 76
10 CoreFoundation 0x0000000185f37854 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 28
11 CoreFoundation 0x0000000185f34adc __CFRunLoopDoObservers + 368
12 CoreFoundation 0x0000000185e75df4 CFRunLoopRunSpecific + 488
13 GraphicsServices 0x000000018bb5dc08 GSEventRunModal + 164
14 UIKit 0x0000000188fa6fc0 UIApplicationMain + 1152
15 App 0x00000001000c8808 main (main.m:16)
16 libdyld.dylib 0x0000000192a73a9c start + 0
Thread 1 Crashed:
0 libsystem_kernel.dylib 0x0000000192b55aa8 kevent64 + 8
1 libdispatch.dylib 0x0000000192a59998 _dispatch_mgr_thread + 48
Thread 2 name: com.apple.NSURLConnectionLoader
Thread 2:
0 libsystem_kernel.dylib 0x0000000192b55ca0 mach_msg_trap + 8
1 CoreFoundation 0x0000000185f36d20 __CFRunLoopServiceMachPort + 180
2 CoreFoundation 0x0000000185f34eb0 __CFRunLoopRun + 832
3 CoreFoundation 0x0000000185e75dcc CFRunLoopRunSpecific + 448
4 Foundation 0x0000000186a6a424 +[NSURLConnection(Loader) _resourceLoadLoop:] + 344
5 Foundation 0x0000000186af8408 __NSThread__main__ + 996
6 libsystem_pthread.dylib 0x0000000192befe18 _pthread_body + 164
7 libsystem_pthread.dylib 0x0000000192befd70 _pthread_start + 13

iOS device log crashed EXC_CRASH 0x0000000000000000

I have only a little knowledge on how to read the crash reason in device logs. Please give me some clue on where should I start to look at in my app. It crashed the minute I clicked on a button when I open the app. I only got this error when I unplugged the device. I cannot reproduce the device if I try to build with my phone via Xcode.
Thank you.
OS Version: iOS 7.0.5 (11B601)
Report Version: 104
Exception Type: EXC_CRASH (SIGSEGV)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread: 1
Thread 0:
0 libobjc.A.dylib 0x3a45bb66 objc_msgSend + 6
1 CoreFoundation 0x3003ec4a -[__NSDictionaryM setObject:forKey:] + 178
2 UIKit 0x32b157a4 -[NSString(UIStringDrawingLegacy) _legacy_drawInRect:withFont:lineBreakMode:alignment:lineSpacing:includeEmoji:truncationRect:] + 456
3 UIKit 0x32b155c8 -[NSString(UIStringDrawingLegacy) _legacy_drawInRect:withFont:lineBreakMode:alignment:lineSpacing:includeEmoji:] + 72
4 UIKit 0x32b15512 -[NSString(UIStringDrawingLegacy) _legacy_drawInRect:withFont:lineBreakMode:alignment:] + 70
5 UIKit 0x32b14f9e -[NSString(UIStringDrawing) drawInRect:withFont:lineBreakMode:alignment:] + 54
6 ST iPhone Standalone AppStore 0x001fc4a4 -[ArticleTableViewCell_CG drawContentView:] (ArticleTableViewCell_CG.m:178)
7 ST iPhone Standalone AppStore 0x001f9a7c -[ABTableViewCellView drawRect:] (ABTableViewCell.m:43)
8 UIKit 0x32907dd4 -[UIView(CALayerDelegate) drawLayer:inContext:] + 368
9 QuartzCore 0x3253da74 -[CALayer drawInContext:] + 96
10 QuartzCore 0x32527240 CABackingStoreUpdate_ + 1856
11 QuartzCore 0x326012e8 ___ZN2CA5Layer8display_Ev_block_invoke + 48
12 QuartzCore 0x32526af0 x_blame_allocations + 80
13 QuartzCore 0x325267a2 CA::Layer::display_() + 1114
14 QuartzCore 0x3250a364 CA::Layer::display_if_needed(CA::Transaction*) + 204
15 QuartzCore 0x32509ffc CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 20
16 QuartzCore 0x32509a08 CA::Context::commit_transaction(CA::Transaction*) + 224
17 QuartzCore 0x3250981a CA::Transaction::commit() + 310
18 QuartzCore 0x32503548 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 52
19 CoreFoundation 0x300cef66 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 18
20 CoreFoundation 0x300cc8f2 __CFRunLoopDoObservers + 282
21 CoreFoundation 0x300ccc3e __CFRunLoopRun + 734
22 CoreFoundation 0x3003746c CFRunLoopRunSpecific + 520
23 CoreFoundation 0x3003724e CFRunLoopRunInMode + 102
24 GraphicsServices 0x34d712e6 GSEventRunModal + 134
25 UIKit 0x328ec840 UIApplicationMain + 1132
26 ST iPhone Standalone AppStore 0x000597cc main (main.m:14)
27 ST iPhone Standalone AppStore 0x00059764 start + 36
Thread 1 Crashed:
0 libsystem_kernel.dylib 0x3a9fd838 kevent64 + 24
1 libdispatch.dylib 0x3a94c0d0 _dispatch_mgr_invoke + 228
2 libdispatch.dylib 0x3a94661e _dispatch_mgr_thread + 34

Why class method appears twice in the call stack of the crash log, iOS

I got a crash log from an app that is already in App Store. The weird part of the crash log is that a class method appears twice in the backtrace of the crashed thread, as if the class method recursively called itself. I said weird because that class method is quite simple and it doesn't make a recursive call inside method body. Here is the part from the crash log:
Exception Type: EXC_BAD_ACCESS (SIGABRT)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000000
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x3b788350 __pthread_kill + 8
1 libsystem_c.dylib 0x3b6fefb2 pthread_kill + 54
2 libsystem_c.dylib 0x3b73b366 abort + 90
3 btg2 0x0172a358 ___lldb_unnamed_function128645$$btg2 + 280
4 btg2 0x0171af34 ___lldb_unnamed_function128478$$btg2 + 256
5 libsystem_c.dylib 0x3b708d38 _sigtramp + 40
6 btg2 0x0129fd7c +[PHAPIRequest expectedSignatureValueForResponse:nonce:secret:] (PHAPIRequest.m:129)
7 btg2 0x0129fd7c +[PHAPIRequest expectedSignatureValueForResponse:nonce:secret:] (PHAPIRequest.m:129)
8 btg2 0x012a1ee4 -[PHAPIRequest connectionDidFinishLoadingWithRequest:response:data:context:] (PHAPIRequest.m:501)
9 btg2 0x012aee04 -[PHConnectionManager connectionDidFinishLoading:] (PHConnectionManager.m:234)
10 Foundation 0x33d46912 __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke_0 + 14
11 Foundation 0x33c86764 -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 196
12 Foundation 0x33c86680 -[NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 56
13 CFNetwork 0x330e764c ___delegate_didFinishLoading_block_invoke_0 + 24
14 CFNetwork 0x330e6d30 ___withDelegateAsync_block_invoke_0 + 52
15 CFNetwork 0x3310f010 ___performAsync_block_invoke_068 + 16
16 CoreFoundation 0x33350aca CFArrayApplyFunction + 174
17 CFNetwork 0x3310f46e RunloopBlockContext::perform() + 70
18 CFNetwork 0x3307345e MultiplexerSource::perform() + 186
19 CoreFoundation 0x333df8f4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 12
20 CoreFoundation 0x333df158 __CFRunLoopDoSources0 + 208
21 CoreFoundation 0x333ddf2a __CFRunLoopRun + 642
22 CoreFoundation 0x33351238 CFRunLoopRunSpecific + 352
23 CoreFoundation 0x333510c4 CFRunLoopRunInMode + 100
24 GraphicsServices 0x36f0c336 GSEventRunModal + 70
25 UIKit 0x3526d2b4 UIApplicationMain + 1116
26 btg2 0x0007da00 main (main.mm:21)
27 btg2 0x0007a504 ___lldb_unnamed_function1$$btg2 + 36
Does any one have a reasoning why +[PHAPIRequest expectedSignatureValueForResponse:nonce:secret:] appears twice in the backtrace or may be knows the reason of the crash? Appreciate your help!

Resources