I need help solving a problem where I experience an occasional EXC_BAD_ACCESS crash that occurs in the AudioToolBox (AVAudioSessionPropertyListener) . Most of them happened in background and it's not easy to reproduce the bug.
The following is the call trace:
Thread : Crashed: AVAudioSession Notify Thread
0 libobjc.A.dylib 0x18243dbd0 objc_msgSend + 16
1 libAVFAudio.dylib 0x188f333c8 LocalPlayerHandleCallback(AVAudioPlayer*, unsigned int, unsigned long, void const*) + 368
2 libAVFAudio.dylib 0x188f37098 AVAudioPlayerCpp::sessionPropertyListener(unsigned int, unsigned int, void const*) + 360
3 AudioToolbox 0x1852d27c0 AudioSessionPropertyListeners::CallPropertyListenersImp(unsigned int, unsigned int, void const*) + 352
4 AudioToolbox 0x1852d2584 AudioSessionPropertyListeners::CallPropertyListeners(unsigned int, unsigned int, void const*) + 280
5 AudioToolbox 0x1852d1a60 ProcessDeferredMessage(__CFData const*, unsigned int, unsigned int) + 512
6 AudioToolbox 0x1852d14e4 ASCallbackReceiver_AudioSessionPingMessage + 408
7 AudioToolbox 0x1853cc5e8 _XAudioSessionPingMessage + 44
8 AudioToolbox 0x1851c5900 mshMIGPerform + 248
9 CoreFoundation 0x182d75634 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 56
10 CoreFoundation 0x182d74d6c __CFRunLoopDoSource1 + 436
11 CoreFoundation 0x182d72ac4 __CFRunLoopRun + 1800
12 CoreFoundation 0x182ca1680 CFRunLoopRunSpecific + 384
13 libAVFAudio.dylib 0x188f69834 GenericRunLoopThread::Entry(void*) + 164
14 libAVFAudio.dylib 0x188f3e3a8 CAPThread::Entry(CAPThread*) + 84
15 libsystem_pthread.dylib 0x182a27b28 _pthread_body + 156
16 libsystem_pthread.dylib 0x182a27a8c _pthread_body + 154
17 libsystem_pthread.dylib 0x182a25028 thread_start + 4Does anybody have an idea of what could possibly be happening or what should I do to solve it? Thanks!
This is an objc_msgSend crasher and there's a number of things you can do to attempt to track down what's going on. The first place to look is the most likely case - a message being sent to an object that no longer exists. As it looks like there's some audio session property handling going on, are you using an AVAudioPlayerDelegate, if so, is that object going away before you expect it to. How about AVAudioPlayer itself, is it possible it's being released during playback...these are the first things to check. You can also use NSZombieEnabled, and searching for objc_msgSend will yield some very helpful blogs and links discussing how to figure out what exactly is wrong. If you've exhausted all possibilities and have a simple test case the replicates the problem on the off chance this is our bug, please file a bug report so we can take a look.
Some References:
https://developer.apple.com/library/ios/technotes/tn2239/_index.html