Core Data : crash when merge change, due to 'objc_msgSend' - iphone

The last call objc_msgSend tells that it may be Zombie Messaged, but it's in the Core Data library code...
Exception Type: EXC_CRASH (SIGSEGV)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread: 1
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0:
0 libobjc.A.dylib 0x37a6ef78 objc_msgSend + 16
1 CoreData 0x3601a748 -[_CDSnapshot dealloc] + 60
2 CoreData 0x3601a336 -[_CDSnapshot release] + 118
3 CoreData 0x3601a6c4 _NSQLRow_dealloc_standard + 52
4 CoreData 0x3601a67c _PFfastRowRelease + 24
5 CoreFoundation 0x35692936 __CFDictionaryReleaseValue + 26
6 CoreFoundation 0x356e6104 __CFBasicHashRemoveValue + 96
7 CoreFoundation 0x3561a7e4 CFBasicHashRemoveValue + 2900
8 CoreFoundation 0x35619c60 CFDictionaryRemoveValue + 172
9 CoreData 0x3601a62e -[NSPersistentStoreCache decrementRefCountForObjectID:] + 66
10 CoreData 0x3601a5b0 -[NSSQLCore managedObjectContextDidUnregisterObjectsWithIDs:] + 124
11 CoreData 0x3601a4f6 -[NSPersistentStoreCoordinator(_NSInternalMethods) _informAffectedStoresOfInterestByChildContextInObjectsWithObjectIDs:withSelector:] + 414
12 CoreData 0x3601af34 -[_PFManagedObjectReferenceQueue _processReferenceQueue:] + 1800
13 CoreData 0x3606a1f6 -[NSManagedObjectContext _mergeChangesFromDidSaveDictionary:usingObjectIDs:] + 2078
14 CoreData 0x36069092 -[NSManagedObjectContext mergeChangesFromContextDidSaveNotification:] + 182
15 Messenger -[WXManagedObjectContextManager managedObjectContextDidSave:] (in Messenger) (WXManagedObjectContextManager.m:106)
16 CoreFoundation 0x3562c1f4 -[NSObject performSelector:withObject:] + 36
17 Foundation 0x351f0740 __NSThreadPerformPerform + 344
18 CoreFoundation 0x356a1acc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 8
19 CoreFoundation 0x356a1298 __CFRunLoopDoSources0 + 208
20 CoreFoundation 0x356a003e __CFRunLoopRun + 646
21 CoreFoundation 0x3562349e CFRunLoopRunSpecific + 294
22 CoreFoundation 0x35623366 CFRunLoopRunInMode + 98
23 GraphicsServices 0x372bf432 GSEventRunModal + 130
24 UIKit 0x3312fcce UIApplicationMain + 1074
25 Messenger 0x000034fc 0x1000 + 9468
26 Messenger 0x00003468 0x1000 + 9320
Thread 1 name: Dispatch queue: com.apple.libdispatch-manager
Thread 1 Crashed:
0 libsystem_kernel.dylib 0x35f733a8 kevent + 24
1 libdispatch.dylib 0x3455df04 _dispatch_mgr_invoke + 708
2 libdispatch.dylib 0x3455dc22 _dispatch_mgr_thread + 30

May be its problem from begin so use any option from bellow ways..
set exception breakpoint in your application and for that follow this link ios-5-xcode-backtrace.
OR
2.Try to run the application with NSZombieEnabled from this link how-to-enable-nszombie-in-xcode also

Related

Mysterious app crash after AppStore update

We have released an app to the AppStore and after an update it crashes after trying to login. We have been heavily relying on a CoreData database in it and we think it is the reason of the crash. Nevertheless I couldn't get any valuable info from the device, just a crash log that features some thread information. Here's how it looks:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0xd0000008
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x32b3e5b0 objc_msgSend + 16
1 Foundation 0x337cbd18 -[NSError dealloc] + 56
2 libobjc.A.dylib 0x32b40484 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 164
3 CoreFoundation 0x31bc843c _CFAutoreleasePoolPop + 12
4 Foundation 0x337ccf76 -[NSAutoreleasePool drain] + 118
5 CoreData 0x32f6d4ae -[NSManagedObjectContext save:] + 1206
6 ourapp 0x0012fbf8 0xba000 + 482296
7 CoreData 0x32f70bbe developerSubmittedBlockToNSManagedObjectContextPerform + 86
8 CoreData 0x32f70cee -[NSManagedObjectContext performBlockAndWait:] + 90
9 ourapp 0x0012fb4c 0xba000 + 482124
10 ourapp 0x000c4e08 0xba000 + 44552
11 ourapp 0x000cced4 0xba000 + 77524
12 ourapp 0x000db50a 0xba000 + 136458
13 ourapp 0x0014c41a 0xba000 + 599066
14 Foundation 0x33893ef2 __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke_0 + 14
15 Foundation 0x337d39ec -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 196
16 Foundation 0x337d3908 -[NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 56
17 CFNetwork 0x38da65dc ___delegate_didFinishLoading_block_invoke_0 + 24
18 CFNetwork 0x38da5cc8 ___withDelegateAsync_block_invoke_0 + 52
19 CFNetwork 0x38dce130 ___performAsync_block_invoke_068 + 16
20 CoreFoundation 0x31bcb74a CFArrayApplyFunction + 174
21 CFNetwork 0x38dce58e RunloopBlockContext::perform() + 70
22 CFNetwork 0x38d3215a MultiplexerSource::perform() + 186
23 CoreFoundation 0x31c5a680 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 12
24 CoreFoundation 0x31c59f7a __CFRunLoopDoSources0 + 358
25 CoreFoundation 0x31c58cb2 __CFRunLoopRun + 642
26 CoreFoundation 0x31bcbeb8 CFRunLoopRunSpecific + 352
27 CoreFoundation 0x31bcbd44 CFRunLoopRunInMode + 100
28 GraphicsServices 0x399c92e6 GSEventRunModal + 70
29 UIKit 0x394872f4 UIApplicationMain + 1116
30 ourapp 0x000be76a 0xba000 + 18282
31 ourapp 0x000bb684 0xba000 + 5764
Are there any other chances I can get more info out of this situation? How can I plug it in to XCode and possibly trace the crash or it can only be done post-factum?
And most importantly, what do you think is causing the crash?
Our problem was connected with Core Data lightweight migration. We were using the "Magical Record" library for handling our Core Data fetches and updating it solved the problem.
Also, this blog post was quite useful.

app crashes due to map kit with MKReverseGeocoder

I don't understand why this is crashing, whenever i came back to home page this app crashes, I have a file LocationSelectViewController.m when enabling zombie it throws an error
[LocationSelectViewController respondsToSelector:]: message sent to deallocated instance 0x27b96740
Let me share a crash log
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0:
0 libobjc.A.dylib 0x3b2665d0 objc_msgSend + 16
1 MapKit 0x343b7492 -[MKReverseGeocoder _notifyResult:] + 70
2 ProtocolBuffer 0x389631b6 -[PBRequester connectionDidFinishLoading:] + 1042
3 Foundation 0x33eac912 __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke_0 + 14
4 Foundation 0x33dec764 -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 196
5 Foundation 0x33dec680 -[NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 56
6 CFNetwork 0x3324d64c ___delegate_didFinishLoading_block_invoke_0 + 24
7 CFNetwork 0x3324cd30 ___withDelegateAsync_block_invoke_0 + 52
8 CFNetwork 0x33275010 ___performAsync_block_invoke_068 + 16
9 CoreFoundation 0x334b6aca CFArrayApplyFunction + 174
10 CFNetwork 0x3327546e RunloopBlockContext::perform() + 70
11 CFNetwork 0x331d945e MultiplexerSource::perform() + 186
12 CoreFoundation 0x335458f4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 12
13 CoreFoundation 0x33545158 __CFRunLoopDoSources0 + 208
14 CoreFoundation 0x33543f2a __CFRunLoopRun + 642
15 CoreFoundation 0x334b7238 CFRunLoopRunSpecific + 352
16 CoreFoundation 0x334b70c4 CFRunLoopRunInMode + 100
17 GraphicsServices 0x37096336 GSEventRunModal + 70
18 UIKit 0x353d32b4 UIApplicationMain + 1116
19 PlanetTran 0x000af534 0xae000 + 5428
20 PlanetTran 0x000af4cc 0xae000 + 5324
Thread 1 name: Dispatch queue: com.apple.libdispatch-manager
Thread 1 Crashed:
0 libsystem_kernel.dylib 0x3b74f5d0 kevent64 + 24
1 libdispatch.dylib 0x3b68ad22 _dispatch_mgr_invoke + 806
2 libdispatch.dylib 0x3b686374 _dispatch_mgr_thread + 32
Try to convert your application in ARC(Automatic reference counting).
message sent to deallocated instance means you are trying to send the message that object is destroyed Automatically so you are getting this exceptions.
For converting in ARC goto Xcode
Edit->Refactor->convert to objective c ARC

Need help in finding crash cause

Below are the crash logs from an iPad. I'm getting this crash randomly while I'm pushing and popping out a UIViewController from Navigation controller. Any help/pointer is appreciated.
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000000
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x31430386 _ZL12realizeClassP7class_t + 34
1 libobjc.A.dylib 0x314303e6 _ZL12realizeClassP7class_t + 130
2 libobjc.A.dylib 0x3142a836 prepareForMethodLookup + 74
3 libobjc.A.dylib 0x3142a740 lookUpMethod + 40
4 libobjc.A.dylib 0x3142a70c _class_lookupMethodAndLoadCache3 + 12
5 libobjc.A.dylib 0x31429fc4 objc_msgSend_uncached + 20
6 UIKit 0x3186553e -[UINavigationItem _accumulateViewsFromItems:isLeft:refreshViews:] + 270
7 UIKit 0x31851244 -[UINavigationItem _updateViewsForBarSizeChangeAndApply:] + 124
8 UIKit 0x319e023a __33-[UINavigationBar layoutSubviews]_block_invoke_0 + 250
9 UIKit 0x31838b46 +[UIView(Animation) _performWithoutAnimation:] + 62
10 UIKit 0x3184d2e2 -[UINavigationBar layoutSubviews] + 382
11 UIKit 0x31814f30 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 176
12 CoreFoundation 0x315431f4 -[NSObject performSelector:withObject:] + 36
13 QuartzCore 0x35459a9e -[CALayer layoutSublayers] + 210
14 QuartzCore 0x354596b6 CA::Layer::layout_if_needed(CA::Transaction*) + 210
15 QuartzCore 0x3545d83c CA::Context::commit_transaction(CA::Transaction*) + 220
16 QuartzCore 0x3545d578 CA::Transaction::commit() + 308
17 QuartzCore 0x354554b2 CA:::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 50
18 CoreFoundation 0x315b8b14 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 12
19 CoreFoundation 0x315b6d50 __CFRunLoopDoObservers + 252
20 CoreFoundation 0x315b70aa __CFRunLoopRun + 754
21 CoreFoundation 0x3153a49e CFRunLoopRunSpecific + 294
22 CoreFoundation 0x3153a366 CFRunLoopRunInMode + 98
23 GraphicsServices 0x32a13432 GSEventRunModal + 130
24 UIKit 0x3183fcce UIApplicationMain + 1074
25 SmartClassTPS 0x000b551a main (main.m:16)
26 SmartClassTPS 0x000b5170 start + 32
Was able to figure out long back but forgot to update here. KVO observer not removed! Silly me :-|. BTW thanks for the support. SO rocks.
Most probably you forgot to clear some delegates before releasing an object.

how to debug EXC_CRASH (SIGTRAP)

i'm running my app are running fine until i resume from background or with out location services, the app will crash.
the crash log shows Exception Type: EXC_CRASH (SIGTRAP)
Anybody know how to debug it ?
Exception Type: EXC_CRASH (SIGTRAP)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x36398848 __kill + 8
1 FrogFinder 0x000b5034 0x69000 + 311348
2 CoreFoundation 0x3447e980 __handleUncaughtException + 68
3 libobjc.A.dylib 0x346ce2ca _objc_terminate + 122
4 libc++abi.dylib 0x338a33be _ZL19safe_handler_callerPFvvE + 70
5 libc++abi.dylib 0x338a344a std::terminate() + 14
6 libc++abi.dylib 0x338a481e __cxa_rethrow + 82
7 libobjc.A.dylib 0x346ce22e objc_exception_rethrow + 6
8 CoreFoundation 0x343d453e CFRunLoopRunSpecific + 398
9 CoreFoundation 0x343d439e CFRunLoopRunInMode + 98
10 GraphicsServices 0x30c58fc6 GSEventRunModal + 150
11 UIKit 0x3785573c UIApplicationMain + 1084
12 FrogFinder 0x0006a7e6 0x69000 + 6118
13 FrogFinder 0x0006a7a4 0x69000 + 6052
Thread 1 name: Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0 libsystem_kernel.dylib 0x363893b4 kevent + 24
1 libdispatch.dylib 0x370b3e78 _dispatch_mgr_invoke + 708
2 libdispatch.dylib 0x370b3b96 _dispatch_mgr_thread + 30
Thread 2 name: WebThread
Thread 2:
0 libsystem_kernel.dylib 0x36389010 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x36389206 mach_msg + 50
2 CoreFoundation 0x3445241c __CFRunLoopServiceMachPort + 120
3 CoreFoundation 0x34451154 __CFRunLoopRun + 876
4 CoreFoundation 0x343d44d6 CFRunLoopRunSpecific + 294
5 CoreFoundation 0x343d439e CFRunLoopRunInMode + 98
6 WebCore 0x368a8128 _ZL12RunWebThreadPv + 396
7 libsystem_c.dylib 0x33224c16 _pthread_start + 314
8 libsystem_c.dylib 0x33224ad0 thread_start + 0
Thread 3 name: com.apple.NSURLConnectionLoader
Thread 3:
0 libsystem_kernel.dylib 0x36389010 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x36389206 mach_msg + 50
2 CoreFoundation 0x3445241c __CFRunLoopServiceMachPort + 120
3 CoreFoundation 0x34451154 __CFRunLoopRun + 876
4 CoreFoundation 0x343d44d6 CFRunLoopRunSpecific + 294
5 CoreFoundation 0x343d439e CFRunLoopRunInMode + 98
6 Foundation 0x35dd4bc2 +[NSURLConnection(Loader) _resourceLoadLoop:] + 302
7 Foundation 0x35dd4a8a -[NSThread main] + 66
8 Foundation 0x35e6859a __NSThread__main__ + 1042
9 libsystem_c.dylib 0x33224c16 _pthread_start + 314
10 libsystem_c.dylib 0x33224ad0 thread_start + 0
Thread 4:
0 libsystem_kernel.dylib 0x36389010 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x36389206 mach_msg + 50
2 CoreFoundation 0x3445241c __CFRunLoopServiceMachPort + 120
3 CoreFoundation 0x34451154 __CFRunLoopRun + 876
4 CoreFoundation 0x343d44d6 CFRunLoopRunSpecific + 294
5 CoreFoundation 0x343d439e CFRunLoopRunInMode + 98
6 Foundation 0x35dc8b7e -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 250
7 Foundation 0x35de252c -[NSRunLoop(NSRunLoop) run] + 72
8 FrogFinder 0x000c8da6 0x69000 + 392614
9 Foundation 0x35dd4a8a -[NSThread main] + 66
10 Foundation 0x35e6859a __NSThread__main__ + 1042
11 libsystem_c.dylib 0x33224c16 _pthread_start + 314
12 libsystem_c.dylib 0x33224ad0 thread_start + 0
Thread 5 name: NetworkIO
Thread 5:
0 libsystem_kernel.dylib 0x36389010 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x36389206 mach_msg + 50
2 CoreFoundation 0x3445241c __CFRunLoopServiceMachPort + 120
3 CoreFoundation 0x34451154 __CFRunLoopRun + 876
4 CoreFoundation 0x343d44d6 CFRunLoopRunSpecific + 294
5 CoreFoundation 0x343d439e CFRunLoopRunInMode + 98
6 MapKit 0x38030412 0x38022000 + 58386
7 Foundation 0x35dd4a8a -[NSThread main] + 66
8 Foundation 0x35e6859a __NSThread__main__ + 1042
9 libsystem_c.dylib 0x33224c16 _pthread_start + 314
10 libsystem_c.dylib 0x33224ad0 thread_start + 0
You can also turn on Exception breakpoints. In XCode 4 click your project and choose the breakpoints tab. At the bottom of that tab is | + | - | search bar. Choose the + item and "Add Exeception Breakpoint". You can leave it at All or choose Objective-C. This way you will break in the debugger and be able to see what caused the exeception.
With Xcode 4.2 and iOS 5 uncaught exceptions do not seem to show in the console anymore. I would recommend adding the following or modifying your existing uncaught exception handler to dump the exceptions callstack for you.
#ifdef DEBUG
void eHandler(NSException *);
void eHandler(NSException *exception) {
NSLog(#"%#", exception);
NSLog(#"%#", [exception callStackSymbols]);
}
#endif
int main(int argc, char *argv[]) {
#ifdef DEBUG
NSSetUncaughtExceptionHandler(&eHandler);
#endif
...rest of your main function here...
}
The easiest way for this kind of crashes which are occuring during development is to add exception break points.
You can add exception breakpoint like below
Select the break points option in left menu in XCode
Add the exception break point
Add breakpoint for all the exceptions
Run the app. In most of the cases when exception occurs XCode will stop the execution and show you the line which caused the exception.

Application Crashing due to EXC_BAD_ACCESS

Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00000000
Crashed Thread: 0
Thread 0 Crashed:
0 libobjc.A.dylib 0x00004420 objc_msgSend + 24
1 CoreFoundation 0x000042a6 CFRetain + 54
2 CoreFoundation 0x0000a9f0 __CFBasicHashStandardRetainValue + 8
3 CoreFoundation 0x000054c0 __CFBasicHashAddValue + 100
4 CoreFoundation 0x00006184 CFBasicHashAddValue + 276
5 CoreFoundation 0x00006cfe CFDictionaryCreate + 58
6 CoreFoundation 0x00033d7c -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 1456
7 CoreFoundation 0x000361bc -[NSDictionary initWithObjectsAndKeys:] + 776
8 iota 0x0000c4cc 0x1000 + 46284
9 iota 0x00009282 0x1000 + 33410
10 iota 0x0000952a 0x1000 + 34090
11 Foundation 0x00015432 _nsnote_callback + 150
12 CoreFoundation 0x000271da __CFXNotificationPost_old + 390
13 CoreFoundation 0x00026e7a _CFXNotificationPostNotification + 122
14 Foundation 0x0000b9f6 -[NSNotificationCenter postNotification:] + 138
15 Foundation 0x0007ae02 postQueueNotifications + 258
16 Foundation 0x0007afae __NSPostIdleQueueNotes + 6
17 CoreFoundation 0x00031084 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 12
18 CoreFoundation 0x00030eb2 __CFRunLoopDoObservers + 494
19 CoreFoundation 0x00028206 __CFRunLoopRun + 934
20 CoreFoundation 0x00027d74 CFRunLoopRunSpecific + 220
21 CoreFoundation 0x00027c82 CFRunLoopRunInMode + 54
22 GraphicsServices 0x00004e84 GSEventRunModal + 188
23 UIKit 0x00004f8c -[UIApplication _run] + 564
24 UIKit 0x000024cc UIApplicationMain + 964
25 iota 0x0000533a 0x1000 + 17210
26 iota 0x000052fc 0x1000 + 17148
NSDictionary *contactNameDictionary = [[NSDictionary alloc] initWithObjectsAndKeys:item, #"contact", sortName, #"contactSortName", compositeName, #"compositeName", nil];
The crashes are random. Like it happens once in 15 trials of a particular action.
KERN_PROTECTION_FAILURE - means that your program is accessing a shared memory that it didn't have access to. That's why kenel sent killed your process. I'm pretty sure that some of your pointers point to wrong location. E.g.
NSObject* obj;
obj would have garbage as it's value. You have to declare it like this:
NSObject* obj = nil;
Without more info, it's hard to say. Usually it's because you try to access/insert into your dictionary an object that doesn't exist anymore.
Check if you're not inserting something that is not an instance of NSObject, like an int or something.
Given that you are using initWithObjectsAndKeys:, make sure that you have nil-terminated the list of arguments, as that's a common mistake that can lead to crashes.