Question

I am developing an iPad application, I am facing a crash issue, but unable to find the cause behind it.

After crash it points to main.mm file only.

Try:

 - NSLogs
 - NSZombiEnabled

Below is the crash log. As of my knowledge, it is using some memory location which has already been freed. But how to identify, which object it is?

Incident Identifier: AF769A76-ADB4-4C3C-9A94-E0B45A994B42
CrashReporter Key:   7443d58afe6b6a3df23c273ba834f8ae4814a7ce
Hardware Model:      iPad2,1
Process:             BLSOffline [3255]
Path:                /var/mobile/Applications/A4C2BB5D-0FE4-4A4D-B1D6-FF6E0183F4EE/BLSOffline.app/BLSOffline
Identifier:          com.bentley.LearnInHouse
Version:             1.0 (1.0)
Code Type:           ARM (Native)
Parent Process:      launchd [1]

Date/Time:           2013-12-02 18:29:21.692 +0530
OS Version:          iOS 7.0.4 (11B554a)
Report Version:      104

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x6192010b
Triggered by Thread:  0

Thread 0 Crashed:
0   libobjc.A.dylib                 0x3a92db26 objc_msgSend + 6
1   MediaPlayer                     0x314a2540 -[MPMoviePlayerControllerNew _moviePlayerWillBecomeActiveNotification:] + 472
2   CoreFoundation                  0x30223116 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 10
3   CoreFoundation                  0x30197252 _CFXNotificationPost + 1714
4   Foundation                      0x30b7cc28 -[NSNotificationCenter postNotificationName:object:userInfo:] + 72
5   MediaPlayer                     0x314a4a60 -[MPMoviePlayerControllerNew _postNotificationName:object:userInfo:] + 96
6   MediaPlayer                     0x314a49f0 -[MPMoviePlayerControllerNew _postNotificationName:object:] + 40
7   MediaPlayer                     0x314a43d4 -[MPMoviePlayerControllerNew _ensureActive] + 128
8   MediaPlayer                     0x314a44a2 -[MPMoviePlayerControllerNew _prepareToPlayWithStartIndex:] + 66
9   MediaPlayer                     0x314a009c -[MPMoviePlayerControllerNew prepareToPlay] + 40
10  MediaPlayer                     0x314a0100 -[MPMoviePlayerControllerNew play] + 44
11  MediaPlayer                     0x314a2b2e -[MPMoviePlayerControllerNew _movieSourceTypeAvailableNotification:] + 350
12  CoreFoundation                  0x30223116 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 10
13  CoreFoundation                  0x30197252 _CFXNotificationPost + 1714
14  Foundation                      0x30b7cc28 -[NSNotificationCenter postNotificationName:object:userInfo:] + 72
15  Foundation                      0x30b81506 -[NSNotificationCenter postNotificationName:object:] + 26
16  MediaPlayer                     0x31525b00 -[MPMovie _determineMediaType] + 152
17  Foundation                      0x30c3b386 __NSFireDelayedPerform + 410
18  CoreFoundation                  0x3022c0dc __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 12
19  CoreFoundation                  0x3022bcf2 __CFRunLoopDoTimer + 778
20  CoreFoundation                  0x3022a08e __CFRunLoopRun + 1206
21  CoreFoundation                  0x30194c22 CFRunLoopRunSpecific + 518
22  CoreFoundation                  0x30194a06 CFRunLoopRunInMode + 102
23  GraphicsServices                0x34e6827e GSEventRunModal + 134
24  UIKit                           0x32a38044 UIApplicationMain + 1132
25  BLSOffline                      0x00116c0e 0xee000 + 166926
26  libdyld.dylib                   0x3ae3aab4 start + 0

Thread 1 name:  gputools.smt_poll.0x14632d20
Thread 1:
0   libsystem_kernel.dylib          0x3aef1550 __semwait_signal + 24
1   libsystem_c.dylib               0x3ae62808 nanosleep + 168
2   libsystem_c.dylib               0x3ae62756 usleep + 46
3   GPUToolsCore                    0x02292f34 smt_poll_thread_entry(void*) + 120
4   libsystem_pthread.dylib         0x3af59c1a _pthread_body + 138
5   libsystem_pthread.dylib         0x3af59b8a _pthread_start + 98
6   libsystem_pthread.dylib         0x3af57c8c thread_start + 4

Thread 2:
0   libsystem_kernel.dylib          0x3aede83c kevent64 + 24
1   libdispatch.dylib               0x3ae1f210 _dispatch_mgr_invoke + 228
2   libdispatch.dylib               0x3ae1ef96 _dispatch_mgr_thread$VARIANT$mp + 34

Thread 3 name:  WebThread
Thread 3:
0   libsystem_kernel.dylib          0x3aef0fa8 __psynch_mutexwait + 24
1   libsystem_pthread.dylib         0x3af57f0a _pthread_mutex_lock + 302
2   WebCore                         0x383037f0 _WebTryThreadLock(bool) + 104
3   WebCore                         0x38303772 WebRunLoopLock(__CFRunLoopObserver*, unsigned long, void*) + 42
4   CoreFoundation                  0x3022c1ca __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 18
5   CoreFoundation                  0x30229b6c __CFRunLoopDoObservers + 280
6   CoreFoundation                  0x30229f7c __CFRunLoopRun + 932
7   CoreFoundation                  0x30194c22 CFRunLoopRunSpecific + 518
8   CoreFoundation                  0x30194a06 CFRunLoopRunInMode + 102
9   WebCore                         0x38302266 RunWebThread(void*) + 414
10  libsystem_pthread.dylib         0x3af59c1a _pthread_body + 138
11  libsystem_pthread.dylib         0x3af59b8a _pthread_start + 98
12  libsystem_pthread.dylib         0x3af57c8c thread_start + 4

Thread 4:
0   libsystem_kernel.dylib          0x3aedea8c mach_msg_trap + 20
1   libsystem_kernel.dylib          0x3aede888 mach_msg + 44
2   CoreFoundation                  0x3022b7be __CFRunLoopServiceMachPort + 150
3   CoreFoundation                  0x30229ee4 __CFRunLoopRun + 780
4   CoreFoundation                  0x30194c22 CFRunLoopRunSpecific + 518
5   CoreFoundation                  0x30194a06 CFRunLoopRunInMode + 102
6   libAVFAudio.dylib               0x2f217584 GenericRunLoopThread::Entry(void*) + 124
7   libAVFAudio.dylib               0x2f20b99c CAPThread::Entry(CAPThread*) + 176
8   libsystem_pthread.dylib         0x3af59c1a _pthread_body + 138
9   libsystem_pthread.dylib         0x3af59b8a _pthread_start + 98
10  libsystem_pthread.dylib         0x3af57c8c thread_start + 4

Thread 5 name:  JavaScriptCore::BlockFree
Thread 5:
0   libsystem_kernel.dylib          0x3aef0f38 __psynch_cvwait + 24
1   libsystem_pthread.dylib         0x3af59224 _pthread_cond_wait + 536
2   libsystem_pthread.dylib         0x3af5a000 pthread_cond_wait + 36
3   JavaScriptCore                  0x311b9d50 JSC::BlockAllocator::blockFreeingThreadMain() + 204
4   JavaScriptCore                  0x311b73a0 WTF::wtfThreadEntryPoint(void*) + 12
5   libsystem_pthread.dylib         0x3af59c1a _pthread_body + 138
6   libsystem_pthread.dylib         0x3af59b8a _pthread_start + 98
7   libsystem_pthread.dylib         0x3af57c8c thread_start + 4

Thread 6 name:  JavaScriptCore::Marking
Thread 6:
0   libsystem_kernel.dylib          0x3aef0f38 __psynch_cvwait + 24
1   libsystem_pthread.dylib         0x3af59224 _pthread_cond_wait + 536
2   libsystem_pthread.dylib         0x3af5a000 pthread_cond_wait + 36
3   JavaScriptCore                  0x31355236 JSC::GCThread::waitForNextPhase() + 74
4   JavaScriptCore                  0x31355290 JSC::GCThread::gcThreadMain() + 48
5   JavaScriptCore                  0x311b73a0 WTF::wtfThreadEntryPoint(void*) + 12
6   libsystem_pthread.dylib         0x3af59c1a _pthread_body + 138
7   libsystem_pthread.dylib         0x3af59b8a _pthread_start + 98
8   libsystem_pthread.dylib         0x3af57c8c thread_start + 4

Thread 7 name:  WebCore: CFNetwork Loader
Thread 7:
0   libsystem_kernel.dylib          0x3aedea8c mach_msg_trap + 20
1   libsystem_kernel.dylib          0x3aede888 mach_msg + 44
2   CoreFoundation                  0x3022b7be __CFRunLoopServiceMachPort + 150
3   CoreFoundation                  0x30229ee4 __CFRunLoopRun + 780
4   CoreFoundation                  0x30194c22 CFRunLoopRunSpecific + 518
5   CoreFoundation                  0x30194a06 CFRunLoopRunInMode + 102
6   WebCore                         0x3834ad5a WebCore::runLoaderThread(void*) + 250
7   JavaScriptCore                  0x311b73a0 WTF::wtfThreadEntryPoint(void*) + 12
8   libsystem_pthread.dylib         0x3af59c1a _pthread_body + 138
9   libsystem_pthread.dylib         0x3af59b8a _pthread_start + 98
10  libsystem_pthread.dylib         0x3af57c8c thread_start + 4

Thread 8 name:  com.apple.NSURLConnectionLoader
Thread 8:
0   libsystem_kernel.dylib          0x3aedea8c mach_msg_trap + 20
1   libsystem_kernel.dylib          0x3aede888 mach_msg + 44
2   CoreFoundation                  0x3022b7be __CFRunLoopServiceMachPort + 150
3   CoreFoundation                  0x30229ee4 __CFRunLoopRun + 780
4   CoreFoundation                  0x30194c22 CFRunLoopRunSpecific + 518
5   CoreFoundation                  0x30194a06 CFRunLoopRunInMode + 102
6   Foundation                      0x30bcf2f2 +[NSURLConnection(Loader) _resourceLoadLoop:] + 314
7   Foundation                      0x30c44c82 __NSThread__main__ + 1058
8   libsystem_pthread.dylib         0x3af59c1a _pthread_body + 138
9   libsystem_pthread.dylib         0x3af59b8a _pthread_start + 98
10  libsystem_pthread.dylib         0x3af57c8c thread_start + 4

Thread 9 name:  com.apple.CFSocket.private
Thread 9:
0   libsystem_kernel.dylib          0x3aef1440 __select + 20
1   CoreFoundation                  0x3022f680 __CFSocketManager + 480
2   libsystem_pthread.dylib         0x3af59c1a _pthread_body + 138
3   libsystem_pthread.dylib         0x3af59b8a _pthread_start + 98
4   libsystem_pthread.dylib         0x3af57c8c thread_start + 4

Thread 10 name:  WebCore: LocalStorage
Thread 10:
0   libsystem_kernel.dylib          0x3aef0f38 __psynch_cvwait + 24
1   libsystem_pthread.dylib         0x3af59224 _pthread_cond_wait + 536
2   libsystem_pthread.dylib         0x3af5a000 pthread_cond_wait + 36
3   JavaScriptCore                  0x311b9e82 WTF::ThreadCondition::timedWait(WTF::Mutex&, double) + 58
4   WebCore                         0x384353a8 WTF::PassOwnPtr<WTF::Function<void ()> > WTF::MessageQueue<WTF::Function<void ()> >::waitForMessageFilteredWithTimeout<bool (WTF::Function<void ()>*)>(WTF::MessageQueueWaitResult&, bool (&)(WTF::Function<void ()>*), double) + 104
5   WebCore                         0x3843532e WebCore::StorageThread::threadEntryPoint() + 162
6   JavaScriptCore                  0x311b73a0 WTF::wtfThreadEntryPoint(void*) + 12
7   libsystem_pthread.dylib         0x3af59c1a _pthread_body + 138
8   libsystem_pthread.dylib         0x3af59b8a _pthread_start + 98
9   libsystem_pthread.dylib         0x3af57c8c thread_start + 4

Thread 11 name:  com.apple.coremedia.player.async
Thread 11:
0   libsystem_kernel.dylib          0x3aedeadc semaphore_wait_trap + 8
1   libdispatch.dylib               0x3ae1d428 _dispatch_semaphore_wait_slow + 172
2   MediaToolbox                    0x3168083c fpa_AsyncMovieControlThread + 1752
3   CoreMedia                       0x307bf234 figThreadMain + 192
4   libsystem_pthread.dylib         0x3af59c1a _pthread_body + 138
5   libsystem_pthread.dylib         0x3af59b8a _pthread_start + 98
6   libsystem_pthread.dylib         0x3af57c8c thread_start + 4

Thread 12 name:  com.apple.coremedia.player.remote
Thread 12:
0   libsystem_kernel.dylib          0x3aedea8c mach_msg_trap + 20
1   libsystem_kernel.dylib          0x3aede888 mach_msg + 44
2   MediaToolbox                    0x31686c58 FigExpressNotificationThread + 84
3   CoreMedia                       0x307bf234 figThreadMain + 192
4   libsystem_pthread.dylib         0x3af59c1a _pthread_body + 138
5   libsystem_pthread.dylib         0x3af59b8a _pthread_start + 98
6   libsystem_pthread.dylib         0x3af57c8c thread_start + 4

Thread 13:
0   libsystem_kernel.dylib          0x3aef1c7c __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x3af57dc6 _pthread_wqthread + 306
2   libsystem_pthread.dylib         0x3af57c80 start_wqthread + 4

Thread 14:
0   libsystem_kernel.dylib          0x3aef1c7c __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x3af57dc6 _pthread_wqthread + 306
2   libsystem_pthread.dylib         0x3af57c80 start_wqthread + 4

Thread 15 name:  com.apple.coremedia.player.async
Thread 15:
0   libsystem_kernel.dylib          0x3aedeadc semaphore_wait_trap + 8
1   libdispatch.dylib               0x3ae1d428 _dispatch_semaphore_wait_slow + 172
2   MediaToolbox                    0x3168083c fpa_AsyncMovieControlThread + 1752
3   CoreMedia                       0x307bf234 figThreadMain + 192
4   libsystem_pthread.dylib         0x3af59c1a _pthread_body + 138
5   libsystem_pthread.dylib         0x3af59b8a _pthread_start + 98
6   libsystem_pthread.dylib         0x3af57c8c thread_start + 4

Thread 16:
0   libsystem_kernel.dylib          0x3aef1c7c __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x3af57dc6 _pthread_wqthread + 306
2   libsystem_pthread.dylib         0x3af57c80 start_wqthread + 4

Thread 0 crashed with ARM Thread State (32-bit):
    r0: 0x145cb7d0    r1: 0x31617754      r2: 0x3b3091a0      r3: 0x00000000
    r4: 0x1918aea0    r5: 0x145cb7d0      r6: 0x00000000      r7: 0x27d134f8
    r8: 0x00000000    r9: 0x619200ff     r10: 0x31617754     r11: 0x145cb7ec
    ip: 0x3b2cd2a4    sp: 0x27d134c0      lr: 0x314a2545      pc: 0x3a92db26
  cpsr: 0x60000030
Was it helpful?

Solution

It seems as if you are forgetting to remove an observer for the movie callbacks:

-(void) dealloc
{
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}

It's likely that the movie player (via NSNotificationCenter) is the object that is using some memory location which has already been freed when it tries to notify its observers

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top