Since the release of iOS16.1.0 and iOS16.1.1, I have received reports from iOS16.1.0 and iOS16.1.1 users about the crash problem. Later, I discovered that this problem occurred only iOS16.1.0 and later. This problem does not occur to all users ,I have tried several methods (such as using different versions of xcode build App), but still not solved...
Here are the crash track caught by firebase:
Crash :com.apple.network.connections EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000036
Crashed: com.apple.network.connections
0 libxpc.dylib 0x16020 _xpc_dictionary_insert + 96
1 Network 0x908504 nw_path_snapshot_agents + 292
2 Network 0x907960 nw_path_snapshot_path + 192
3 Network 0x9257b8 nw_path_necp_update_evaluator + 756
4 Network 0x924aa4 nw_path_necp_check_for_updates + 1268
5 libdispatch.dylib 0x3fdc _dispatch_client_callout + 20
6 libdispatch.dylib 0x746c _dispatch_continuation_pop + 504
7 libdispatch.dylib 0x1aa58 _dispatch_source_invoke + 1588
8 libdispatch.dylib 0xd4f8 _dispatch_workloop_invoke + 1780
9 libdispatch.dylib 0x16e10 _dispatch_workloop_worker_thread + 652
10 libsystem_pthread.dylib 0xdf8 _pthread_wqthread + 288
11 libsystem_pthread.dylib 0xb98 start_wqthread + 8
com.apple.main-thread
0 libsystem_kernel.dylib 0xb48 mach_msg2_trap + 8
1 libsystem_kernel.dylib 0x13008 mach_msg2_internal + 80
2 libsystem_kernel.dylib 0x13248 mach_msg_overwrite + 388
3 libsystem_kernel.dylib 0x108c mach_msg + 24
4 CoreFoundation 0x7aaf0 __CFRunLoopServiceMachPort + 160
5 CoreFoundation 0x7bd34 __CFRunLoopRun + 1232
6 CoreFoundation 0x80ed4 CFRunLoopRunSpecific + 612
7 GraphicsServices 0x1368 GSEventRunModal + 164
8 UIKitCore 0x3a23d0 -[UIApplication _run] + 888
9 UIKitCore 0x3a2034 UIApplicationMain + 340
10 xxxxxx 0x44ea24 main + 14 (main.m:14)
11 ??? 0x1d6e8c960 (缺少)
other thread ......
I am using HockeyApp for crash reporting and getting the following crash. I am unable to reproduce the crash. Can this be due to animating the scroll in the UICollectionView?
Exception Type: SIGSEGV
Exception Codes: SEGV_ACCERR at 0x66dbc2408
Crashed Thread: 0
Application Specific Information:
Selector name found in current argument registers: indexAtPosition:
Thread 0 Crashed:
0 libobjc.A.dylib 0x0000000198e8c0b0 objc_retain + 16
1 UIKit 0x00000001898bade0 -[UICollectionViewData layoutAttributesForItemAtIndexPath:] + 248
2 UIKit 0x0000000189acb1dc -[UICollectionView scrollToItemAtIndexPath:atScrollPosition:animated:] + 256
3 MyApp 0x000000010016c33c -[CalendarView scrollToDate:animated:] (CalendarView.m:183)
4 MyApp 0x00000001001607cc __56-[CalendarViewController _updateHighlightedDateRange]_block_invoke (CalendarViewController.m:577)
5 libdispatch.dylib 0x00000001996916e8 _dispatch_call_block_and_release + 20
6 libdispatch.dylib 0x00000001996916a8 _dispatch_client_callout + 12
7 libdispatch.dylib 0x0000000199696db0 _dispatch_main_queue_callback_4CF + 1840
8 CoreFoundation 0x00000001842781f8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
9 CoreFoundation 0x0000000184276060 __CFRunLoopRun + 1624
10 CoreFoundation 0x00000001841a4ca0 CFRunLoopRunSpecific + 380
11 GraphicsServices 0x000000018f3e0088 GSEventRunModal + 176
12 UIKit 0x00000001898bcffc UIApplicationMain + 200
13 MyApp 0x000000010015c2a4 main (main.m:12)
14 libdyld.dylib 0x00000001996c28b8 start + 0
I use Crashlytics to track crashes and I am seeing some crashes with the stack trace below:
Crashed: com.apple.main-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0xf8560b1c
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x37a20b66 objc_msgSend + 5
1 CoreFoundation 0x2d5f8e8d CFRelease + 560
2 QuartzCore 0x2fad2965 CA::release_objects(X::List<void const*>*) + 16
3 QuartzCore 0x2fad7dcf -[CAAnimation dealloc] + 54
4 libobjc.A.dylib 0x37a30b0b objc_object::sidetable_release(bool) + 174
5 CoreFoundation 0x2d5f8e8d CFRelease + 560
6 QuartzCore 0x2fada419 CA::Layer::run_animation_callbacks(void*) + 240
7 libdispatch.dylib 0x37f0a0af _dispatch_client_callout + 22
8 libdispatch.dylib 0x37f0c9a9 _dispatch_main_queue_callback_4CF + 268
9 CoreFoundation 0x2d6935b1 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
10 CoreFoundation 0x2d691e7d __CFRunLoopRun + 1308
11 CoreFoundation 0x2d5fc471 CFRunLoopRunSpecific + 524
12 CoreFoundation 0x2d5fc253 CFRunLoopRunInMode + 106
13 GraphicsServices 0x323362eb GSEventRunModal + 138
14 UIKit 0x2feb1845 UIApplicationMain + 1136
It looks like CFRelease is being called on some object twice. The problem is I have no idea which animation is causing the crash. The logs aren't very helpful as the crash happens in different places. How do I go about debugging/reproducing this crash or at the very least logging something so that I know what object is being released twice.
Actually this crash is not reproducing every time, even not frequently but we got this crash in our production app. I am not sure where is the problem. It is telling crash is happening in thread 4 in Environments class line number 38.
Code:
NSBundle* bundle = [NSBundle mainBundle];
NSString* envsPListPath = [bundle pathForResource:#"Environment" ofType:#"plist"];
Line 38:
NSDictionary *environments = [[NSDictionary alloc] initWithContentsOfFile:envsPListPath];
But according to exception type:00000020 , app is failed to launch in in-time.
I don't understand whats wrong with above code. Please help me out the relation b/w watchdog crash and above lines of code.
Crash Log:
Incident Identifier: FBDC0D68-9EC3-423C-A0DF-CD08EA079215
Hardware Model: iPod4,1
Process: Sparkle [16542]
Path: /var/mobile/Applications/55887817-5FD2-479A-B124-6ABF1907B339/Sparkle.app/Sparkle
Identifier: Sparkle
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2013-10-26 14:30:43.046 -0400
OS Version: iOS 6.1.3 (10B329)
Report Version: 104
Exception Type: 00000020
Exception Codes: 0x000000008badf00d
Highlighted Thread: 4
Application Specific Information:
com.xxxx.xxx failed to launch in time
Elapsed total CPU time (seconds): 15.060 (user 15.060, system 0.000), 50% CPU
Elapsed application CPU time (seconds): 1.756, 6% CPU
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0:
0 libsystem_kernel.dylib 0x3a106eb4 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x3a107048 mach_msg + 36
2 UIKit 0x33ebb7e6 _UIPasteboardServerCreate + 158
3 UIKit 0x33ebb684 UIPasteboardServerCreate + 208
4 UIKit 0x33ebb54a -[UIPasteboard(Static) _initWithName:system:create:] + 90
5 UIKit 0x34055d9c +[UIPasteboard pasteboardWithName:create:] + 292
6 Sparkle 0x0049fe8a -[ADMS_Churn readFacebookReferrer] + 42
7 Sparkle 0x0049f5ac -[ADMS_Churn setInstallVariables] + 204
8 Sparkle 0x0049f2b0 -[ADMS_Churn setLaunchTypeVariables] + 68
9 Sparkle 0x0049ead4 -[ADMS_Churn trackSessionStart] + 40
10 Sparkle 0x0049ea56 -[ADMS_Churn resumeSession] + 46
11 Sparkle 0x004a7ae4 -[ADMS_NotificationHandler handleApplicationNotifications:] + 112
12 CoreFoundation 0x31eec034 _CFXNotificationPost + 1424
13 Foundation 0x32802594 -[NSNotificationCenter postNotificationName:object:userInfo:] + 68
14 UIKit 0x33e03896 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1754
15 UIKit 0x33dfb846 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 694
16 UIKit 0x33da3c34 -[UIApplication handleEvent:withNewEvent:] + 1000
17 UIKit 0x33da36c8 -[UIApplication sendEvent:] + 68
18 UIKit 0x33da3116 _UIApplicationHandleEvent + 6150
19 GraphicsServices 0x35a955a0 _PurpleEventCallback + 588
20 GraphicsServices 0x35a951ce PurpleEventCallback + 30
21 CoreFoundation 0x31f70170 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
22 CoreFoundation 0x31f70112 __CFRunLoopDoSource1 + 134
23 CoreFoundation 0x31f6ef94 __CFRunLoopRun + 1380
24 CoreFoundation 0x31ee1eb8 CFRunLoopRunSpecific + 352
25 CoreFoundation 0x31ee1d44 CFRunLoopRunInMode + 100
26 UIKit 0x33dfa480 -[UIApplication _run] + 664
27 UIKit 0x33df72fc UIApplicationMain + 1116
28 Sparkle 0x003fafd2 main (main.m:18)
29 libdyld.dylib 0x3a050b1c start + 0
Thread 1 name: Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0 libsystem_kernel.dylib 0x3a107648 kevent64 + 24
1 libdispatch.dylib 0x3a0404ec _dispatch_mgr_invoke + 792
2 libdispatch.dylib 0x3a032df4 _dispatch_mgr_thread$VARIANT$up + 32
Thread 2:
0 libsystem_kernel.dylib 0x3a117d98 __workq_kernreturn + 8
1 libsystem_c.dylib 0x3a065cf6 _pthread_workq_return + 14
2 libsystem_c.dylib 0x3a065a12 _pthread_wqthread + 362
3 libsystem_c.dylib 0x3a0658a0 start_wqthread + 4
Thread 3 name: WebThread
Thread 3:
0 libsystem_kernel.dylib 0x3a106eb4 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x3a107048 mach_msg + 36
2 CoreFoundation 0x31f70040 __CFRunLoopServiceMachPort + 124
3 CoreFoundation 0x31f6ed9e __CFRunLoopRun + 878
4 CoreFoundation 0x31ee1eb8 CFRunLoopRunSpecific + 352
5 CoreFoundation 0x31ee1d44 CFRunLoopRunInMode + 100
6 WebCore 0x37ecf500 RunWebThread(void*) + 440
7 libsystem_c.dylib 0x3a07030e _pthread_start + 306
8 libsystem_c.dylib 0x3a0701d4 thread_start + 4
Thread 4 name: Dispatch queue: momentumMapQueue
Thread 4:
0 libsystem_c.dylib 0x3a060332 szone_malloc_should_clear + 110
1 libsystem_c.dylib 0x3a060290 malloc_zone_malloc + 68
2 CoreFoundation 0x31eda712 _CFRuntimeCreateInstance + 210
3 CoreFoundation 0x31f7953a __CFStringCreateImmutableFunnel3 + 1882
4 CoreFoundation 0x31edd6c6 CFStringCreateWithBytes + 46
5 CoreFoundation 0x31effe76 _uniqueStringForUTF8Bytes + 90
6 CoreFoundation 0x31effd40 parseStringTag + 1304
7 CoreFoundation 0x31efe930 parseXMLElement + 2760
8 CoreFoundation 0x31efdc8e getContentObject + 450
9 CoreFoundation 0x31efe6aa parseXMLElement + 2114
10 CoreFoundation 0x31efdc8e getContentObject + 450
11 CoreFoundation 0x31efe6aa parseXMLElement + 2114
12 CoreFoundation 0x31efdc8e getContentObject + 450
13 CoreFoundation 0x31efe1c4 parseXMLElement + 860
14 CoreFoundation 0x31f0a044 _CFPropertyListCreateFromUTF8Data + 1592
15 CoreFoundation 0x31edcfb6 _CFPropertyListCreateWithData + 882
16 CoreFoundation 0x31edcbe0 CFPropertyListCreateFromXMLData + 116
17 Foundation 0x328114ea +[NSDictionary(NSDictionary) newWithContentsOf:immutable:] + 110
18 Sparkle 0x006c4f66 -[Environments initializeSharedInstance] (Environments.m:38)
19 Sparkle 0x006c4d54 +[Environments sharedInstance] (Environments.m:27)
20 Sparkle 0x006c4992 +[ConfigurationManager getLogLevel:] (ConfigurationManager.m:54)
21 Sparkle 0x006c4870 +[ConfigurationManager logLevelForFileName:] (ConfigurationManager.m:21)
22 Sparkle 0x006e824a -[NTRequestPolicy init] (NTRequestPolicy.m:38)
23 Sparkle 0x006e80f6 +[NTRequestPolicy sharedRequestPolicy] (NTRequestPolicy.m:24)
24 Sparkle 0x004f5fe8 +[WAGServiceHandler execute:requestObject:responseClass:serviceCallBack:requestType:additionalHTTPHeaders:backgroundRequest:] (WAGServiceHandler.m:39)
25 Sparkle 0x004f5ed0 +[WAGServiceHandler execute:requestObject:responseClass:serviceCallBack:requestType:] (WAGServiceHandler.m:26)
26 Sparkle 0x004f5e72 +[WAGServiceHandler execute:requestObject:responseClass:serviceCallBack:] (WAGServiceHandler.m:20)
27 Sparkle 0x0040acaa -[Mbox load] (Mbox.m:118)
28 Sparkle 0x0040bf52 -[MBoxHandler invokeMboxManager] (MBoxHandler.m:47)
29 Sparkle 0x0040d548 __39-[MomentumMapPlugIn downloadIconImages]_block_invoke (MomentumMapPlugIn.m:222)
30 libdispatch.dylib 0x3a03111c _dispatch_call_block_and_release + 8
31 libdispatch.dylib 0x3a030996 _dispatch_queue_drain$VARIANT$up + 142
32 libdispatch.dylib 0x3a030890 _dispatch_queue_invoke$VARIANT$up + 32
33 libdispatch.dylib 0x3a03f212 _dispatch_root_queue_drain + 190
34 libdispatch.dylib 0x3a03f3b4 _dispatch_worker_thread2 + 80
35 libsystem_c.dylib 0x3a065a0e _pthread_wqthread + 358
36 libsystem_c.dylib 0x3a0658a0 start_wqthread + 4
Simply put, Exception Type 20 means you are doing asynchronous networking on the main thread and when the connection or operation is slow, the App can be terminated by iOS. This will occur randomly. See this note:
https://developer.apple.com/library/ios/qa/qa1693/_index.html
If you get Exception Type: 00000020 and Exception Codes: 0x8badf00d in your crash log then it is Watchdog time out crash report.
This happens when you execute activity synchronously on main thread.
Fix for this is to use asynchronously on main thread.
This Apple document provides detail about this crash in detail.
Do one thing modify your code like that below and test.
if([[NSFileManager DefaultManger]
fileExistAtPath:envsPListPath]){
NSDictionary *environments = [[NSDictionary
dictionaryWithContentsOfFile:envsPListPath];
}
Find in which thread your app is crashing and put that thread in
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
dispatch_async(dispatch_get_main_queue(), ^{
// run that crashing thread here.
});
});
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!