Abnormal main.m crash - ios

In my iOS app, I keep getting crash reports like this one.
0 libsystem_kernel.dylib 0x000000018d805014 __pthread_kill + 4
1 libsystem_c.dylib 0x000000018d7799c4 abort + 136
2 libc++abi.dylib 0x000000018d2451b0 abort_message + 128
3 libc++abi.dylib 0x000000018d25ec04 default_terminate_handler() + 300
4 libobjc.A.dylib 0x000000018d26c820 objc_terminate() + 120
5 libc++abi.dylib 0x000000018d25b5d4 std::__terminate() + 12
6 libc++abi.dylib 0x000000018d25b640 std::terminate() + 56
7 libdispatch.dylib 0x000000018d6c29b4 _dispatch_client_callout + 32
8 libdispatch.dylib 0x000000018d6c75e8 _dispatch_main_queue_callback_4CF + 992
9 CoreFoundation 0x000000018e7b90c0 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
10 CoreFoundation 0x000000018e7b6cdc __CFRunLoopRun + 1568
11 CoreFoundation 0x000000018e6e6d94 CFRunLoopRunSpecific + 420
12 GraphicsServices 0x0000000190150074 GSEventRunModal + 96
13 UIKit 0x000000019499f44c UIApplicationMain + 204
! 14 MyAppNameHere 0x000000010007b090 main (main.m:33)
15 libdyld.dylib 0x000000018d6f559c start + 0
The strange thing is that none of this exists within my code except for the main.m. All other threads in my application don't have anything related to either. This crash appears to only happen for a fraction of a percent of my users, so I am not sure where to even start looking.

The question as it is formulated right now is not answerable, because it is missing necessary information. See e.g. this tutorial for an explanation of how to obtain a real backtrace and how to obtain a "crash reason". Without following the recommended steps for debugging crashes every crash of an iOS-app looks exactly the same as the crash you just provided.
In order to get a real/useful backtrace, you need to set an exception breakpoint in Xcode.

Related

What does it mean by DiskCookies Crash on iOS App?

I use Fabric to log crash on my iOS App.
Today, I came across some crash related to DiskCookies. I really don't know what it means.
Crashed: diskcookies
0 CoreFoundation 0x1bd00136 CFNotificationCenterPostNotification + 53
1 libsystem_malloc.dylib 0x1b5d9cf3 szone_malloc_should_clear + 3240
2 CFNetwork 0x1c44a359 DiskCookieStorage::writeFileCompletely0(DiskCookieStorage*, FilePathStat*, MemoryCookies const*, __CFData const*, TracerData*, int) + 634
3 CFNetwork 0x1c44a49d DiskCookieStorage::_asyncWriteFileCompletely(void*) + 174
4 libdispatch.dylib 0x1b4a1783 _dispatch_client_callout + 22
5 libdispatch.dylib 0x1b4ada35 _dispatch_barrier_sync_f_invoke + 50
6 CFNetwork 0x1c44b09d DiskCookieStorage::syncStorageWithCompletionLocked(unsigned char, void () block_pointer) + 2220
7 CFNetwork 0x1c44277b ___CFHTTPCookieStorageFlushCookieStores_block_invoke + 86
8 CoreFoundation 0x1bcf5447 __CFDictionaryApplyFunction_block_invoke + 20
9 CoreFoundation 0x1bce0634 CFBasicHashApply + 120
10 CoreFoundation 0x1bce94c1 CFDictionaryApplyFunction + 152
11 CFNetwork 0x1c44270f _CFHTTPCookieStorageFlushCookieStores + 140
12 libsystem_c.dylib 0x1b53720d __cxa_finalize_ranges + 290
13 libsystem_c.dylib 0x1b4f61b3 exit + 12
14 Comico 0x97a74f UnityGetGLViewController + 4756906
15 Comico 0x97a265 UnityGetGLViewController + 4755648
16 Comico 0x980a6b UnityGetGLViewController + 4782278
17 Comico 0x96dfb5 UnityGetGLViewController + 4705808
18 Comico 0x96da59 UnityGetGLViewController + 4704436
19 Comico 0x200fe3 -[AppDelegate setUpAppGuardWithUserID:] (AppDelegate.m:1303)
20 Comico 0x1ff967 __36-[AppDelegate dologinInCallLoginAPI]_block_invoke (AppDelegate.m:1026)
21 Comico 0x13f69b __42-[NCLoginRAPIManager loginWithCompletion:]_block_invoke (NCLoginRAPIManager.m:97)
22 Comico 0xde19f -[NCRAPICompletion performBlockWithOperation:] (NCRAPICompletion.m:94)
23 CoreFoundation 0x1bd06323 -[NSArray makeObjectsPerformSelector:withObject:] + 218
24 Comico 0x3adf0d -[NCRAPIOperationRegister performCompletionBlockOfOperation:] (NCRAPIOperationRegister.m:67)
25 Comico 0x251ce1 __51-[NCRAPIManager callRAPIWithAPIRequest:completion:]_block_invoke_2 (NCRAPIManager.m:65)
26 libdispatch.dylib 0x1b4a1797 _dispatch_call_block_and_release + 10
27 libdispatch.dylib 0x1b4a1783 _dispatch_client_callout + 22
28 libdispatch.dylib 0x1b4a5d05 _dispatch_main_queue_callback_4CF + 902
29 CoreFoundation 0x1bd8fd69 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
30 CoreFoundation 0x1bd8de19 __CFRunLoopRun + 848
31 CoreFoundation 0x1bce11af CFRunLoopRunSpecific + 470
32 CoreFoundation 0x1bce0fd1 CFRunLoopRunInMode + 104
33 GraphicsServices 0x1d48bb41 GSEventRunModal + 80
34 UIKit 0x21069a53 UIApplicationMain + 150
35 Comico 0x20dc39 main (main.m:19)
36 libdyld.dylib 0x1b4ce4eb start + 2
I believe someone is trying to modify the path where network library put data to. Does anyone have any other theory or have some experience on this crash?
From the stack trace you posted here is my theory.
Frame 14 indicates that you've got a Unity application, and it's doing its thing running OpenGL.
Frame 13 is really interesting. It seems like the Unity UnityGetGLViewController (which I assume is not written by you) has called exit. This is surprising behavior, but it gives lots of clues on the rest of the stack.
Frames 12-2 look like the network stack is just doing some work on application exit (triggered by UnityGetGLViewController). Seems like it is just writing some cookie-related stuff to disk. I wouldn't worry about this.
Frame 0 and 1 are really suspect. I have a very hard time believing that malloc calls into CoreFoundation. If I had to guess, I would say that frame 0 is correct, and frame 1 has been mis-symbolicated or incorrectly unwound.
It's very unusual to call exit in iOS applications. While it is technically API, I doubt it is heavily tested. My bet is that there are some dangling pointer and/or object lifecycle issues related to the use of exit and you are seeing it here.
What I would do is see if Unity has any documentation around UnityGetGLViewController calling exit. I'd also check in with the Fabric people about frames 1 and 0. I don't see how both could be correct. And, finally, I might consider opening a bug with Apple. However, Apple usually doesn't like looking at non-Apple crash reports. So, that last one is probably a long-shot.

Crash Report Meaning

I just got a crash report from Crashlytics of my app on AppStore.. the crash report is as follows..
Thread : Crashed: com.apple.main-thread
0 libsystem_kernel.dylib 0x3bbf1350 __pthread_kill + 8
1 libsystem_c.dylib 0x3bb67fb7 pthread_kill + 58
2 libsystem_c.dylib 0x3bba436b abort + 94
3 libc++abi.dylib 0x3b14cddf abort_message + 74
4 libc++abi.dylib 0x3b14a099 default_terminate() + 24
5 libobjc.A.dylib 0x3b6fda5b _objc_terminate() + 146
6 libc++abi.dylib 0x3b14a11b safe_handler_caller(void (*)()) + 78
7 libc++abi.dylib 0x3b14a1b4 std::terminate() + 19
8 libc++abi.dylib 0x3b14b62b __cxa_rethrow + 94
9 libobjc.A.dylib 0x3b6fd9b5 objc_exception_rethrow + 12
10 CoreFoundation 0x339532a1 CFRunLoopRunSpecific + 456
11 CoreFoundation 0x339530c9 CFRunLoopRunInMode
12 GraphicsServices 0x3753133b GSEventRunModal + 74
13 UIKit 0x3586f2b9 UIApplicationMain + 1120
14 TradeMate 0x000633d3 main (main.m:16)
Can anyone explain what it is?? cause its not giving anything…
Let me know if anything else is needed..
thanks in advance
All what you can see in this crash dump is that there was an uncaught exception which caused the application to terminate. You would need to look at the stacks of the other threads to get a clue. Also the rest of the crash report is important to see what actually caused the crash.
The crash reporting provided by apple usually contains a lot more details as just a stack. And the link provided by jnix (Demystifying iOS Application Crash Logs) is for sure a good help analysing such logs.
Nevertheless, often it's necessary that you can reproduce a crash in XCode to find out the actual reason for a crash.

How can I debug this crash log

I get this crash log from my device log after that my app is crashed. Before crash I clicked on cancel button from search bar inside UITableView.
How can I understand what and where is the problem ?
how can I debug this kind of log from production device?
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x3b74b1fc __pthread_kill + 8
1 libsystem_pthread.dylib 0x3b7b2a4e pthread_kill + 54
2 libsystem_c.dylib 0x3b6fc028 abort + 72
3 libc++abi.dylib 0x3ab4a98a abort_message + 70
4 libc++abi.dylib 0x3ab636e2 default_terminate_handler() + 250
5 libobjc.A.dylib 0x3b19b936 _objc_terminate() + 190
6 libc++abi.dylib 0x3ab611b0 std::__terminate(void (*)()) + 76
7 libc++abi.dylib 0x3ab60d12 __cxa_rethrow + 98
8 libobjc.A.dylib 0x3b19b80a objc_exception_rethrow + 38
9 CoreFoundation 0x30d724e2 CFRunLoopRunSpecific + 638
10 CoreFoundation 0x30d7224e CFRunLoopRunInMode + 102
11 GraphicsServices 0x35aac2e6 GSEventRunModal + 134
12 UIKit 0x33627840 UIApplicationMain + 1132
13 MYAPPNAME 0x000ffc44 0xfa000 + 23620
14 libdyld.dylib 0x3b694ab4 start + 0
------- EDITED ------
i get Last Exception Backtrace:
0 CoreFoundation 0x30e3ee7e __exceptionPreprocess + 126
1 libobjc.A.dylib 0x3b19b6c2 objc_exception_throw + 34
2 CoreFoundation 0x30e3ed50 +[NSException raise:format:arguments:] + 100
3 Foundation 0x317e70aa -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 86
4 UIKit 0x33796348 -[UITableView _endCellAnimationsWithContext:] + 7940
5 MYAPPNAME 0x00233972 0xfa000 + 1284466
6 MYAPPNAME 0x00232e3c 0xfa000 + 1281596
7 MYAPPNAME 0x00232fd8 0xfa000 + 1282008
8 MYAPPNAME 0x002319d4 0xfa000 + 1276372
9 Foundation 0x3181933a __NSFireDelayedPerform + 410
10 CoreFoundation 0x30e09e7a
__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 10
11 CoreFoundation 0x30e09a96 __CFRunLoopDoTimer + 790
12 CoreFoundation 0x30e07e1e __CFRunLoopRun + 1214
13 CoreFoundation 0x30d7246c CFRunLoopRunSpecific + 520
14 CoreFoundation 0x30d7224e CFRunLoopRunInMode + 102
15 GraphicsServices 0x35aac2e6 GSEventRunModal + 134
16 UIKit 0x33627840 UIApplicationMain + 1132
17 MYAPPNAME 0x000ffc44 0xfa000 + 23620
18 libdyld.dylib 0x3b694ab2 tlv_initializer + 2
The crash happened because of an unhandled exception.
While symbolicating the crash report with the Xcode organizer usually helps, it doesn't help in this case, since stack frame 13 will only show something like main (main.m:14).
If the crash report doesn't contain an Last Exception Backtrace section, the report is basically meaningless.
Try to reproduce the crash while running the app with the debugger or integrate a 3rd party crash report solution that is able to provide the Last Exception Backtrace and also the Application Information section which gives you the detailed exception error.
There are many 3rd party solutions out there, I won't recommend any, since I would be biased :)
Update: As you now provided the Last Exception Backtrace it shows that there is an Assertion triggered when a tableview animation is ending. Once you symbolicates the crash report you'll see which lines of code in your app are causing this.

MPAVController pauseWithFadeout causing app crash

I have an application in which I have links for some videos and when requested by user I download the video files. The downloaded video files are listed in a UITableView. The app crashes occasionally with crash log similar to following.
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x6000000c
Triggered by Thread: 0
Thread 0 Crashed:
0 libobjc.A.dylib 0x3a03fb26 objc_msgSend + 6
1 MediaPlayer 0x30ba3ff0 -[MPAVController _setState:] + 288
2 MediaPlayer 0x30b97f1a -[MPAVController pauseWithFadeout:] + 198
3 MediaPlayer 0x30b9cd22 -[MPAVController _itemPlaybackDidEndNotification:] + 786
4 CoreFoundation 0x2f90011e __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 10
5 CoreFoundation 0x2f874312 _CFXNotificationPost + 1714
6 AVFoundation 0x2e780b6e __avplayeritem_fpItemNotificationCallback_block_invoke + 4094
7 libdispatch.dylib 0x3a527d78 _dispatch_call_block_and_release + 8
8 libdispatch.dylib 0x3a527d64 _dispatch_client_callout + 20
9 libdispatch.dylib 0x3a52e7bc _dispatch_main_queue_callback_4CF$VARIANT$mp + 264
10 CoreFoundation 0x2f90881c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 4
11 CoreFoundation 0x2f9070f0 __CFRunLoopRun + 1296
12 CoreFoundation 0x2f871ce2 CFRunLoopRunSpecific + 518
13 CoreFoundation 0x2f871ac6 CFRunLoopRunInMode + 102
14 GraphicsServices 0x3455f27e GSEventRunModal + 134
15 UIKit 0x32113a3c UIApplicationMain + 1132
16 MyApp 0x000e5884 main (main.m:30)
17 libdyld.dylib 0x3a54cab4 start + 0
The problem is that none of my own methods are shown to fail in the log. All calls seem to be library method calls. Also I wonder why _itemPlaybackDidEndNotification: was called as I encountered this when I was not even playing a video.
Can someone help?
I found the issue in my case. I was using thumbnailImageAtTime:timeOption: which seems to play/pause the video in the background(This is just my conjecture though) to get a thumbnail for it. That caused the itemPlaybackDidEndNotification to fire despite me not playing any video explicitly and cause further issues.
There are now a couple of alternatives if someone else is using same method for getting thumbnails. The methods are mentioned here. thumbnailImageAtTime: now deprecated - What's the alternative?

In iOS, what caused this crash?

I got a crash in my iOS app, but their has only a few messages, some like this.
Application received signal SIGABRT
(null)
(
0 CoreFoundation 0x359c68a7 __exceptionPreprocess + 186
1 libobjc.A.dylib 0x37d6d259 objc_exception_throw + 32
2 CoreFoundation 0x359c6789 +[NSException raise:format:] + 0
3 CoreFoundation 0x359c67ab +[NSException raise:format:] + 34
4 myapp 0x00241bf9 _ZNSt11_Deque_baseIsSaIsEE15_M_create_nodesEPPsS3_ + 1432772
5 libsystem_c.dylib 0x32dd27e3 _sigtramp + 38
6 libsystem_c.dylib 0x32dc820f pthread_kill + 54
7 libsystem_c.dylib 0x32dc129f abort + 94
8 libc++abi.dylib 0x35d7ef6b abort_message + 46
9 libc++abi.dylib 0x35d7c3f1 _ZL19safe_handler_callerPFvvE + 120
10 libc++abi.dylib 0x35d7c451 _ZdlPv + 0
11 libc++abi.dylib 0x35d7d825 __cxa_current_exception_type + 0
12 libobjc.A.dylib 0x37d6d2a9 objc_exception_rethrow + 12
13 CoreFoundation 0x3591c50d CFRunLoopRunSpecific + 404
14 CoreFoundation 0x3591c36d CFRunLoopRunInMode + 104
15 GraphicsServices 0x375b8439 GSEventRunModal + 136
16 UIKit 0x33428cd5 UIApplicationMain + 1080
17 myapp 0x000d4293 _mh_execute_header + 41619
18 myapp 0x000ccd20 _mh_execute_header + 11552
)
I can't find what caused this crash, but it is the most frequently appears in my app. I am very anxious, does any one know something about it? Thanks a lot.
If you are able to reproduce this crash either by performing a certain task or just using the app long enough you could attach the debugger and set a breakpoint for [NSException raise]. This way you can figure out in what part of your application stuff is messed up, I used this in the past to figure out where a NSArray went out of bounds.. ( and I have like a dozen or more spread around all source files )
Secondly you should probably 'symbolicate' the crash report so you can follow the stack trace.. so you can figure out what method/class in your code is messing stuff up.
For see a crash callback, try add in your project this great feature:
CrashKit
This is a exception catcher

Resources