HI all,
We're also encountering this crash in the AQClient thread, now in 10.8.4. It has been difficult for us to recreate ourselves, but it's far and away our most common crash.
I spoke with the original poster (Michael) off list and it sounds like our scenarios are similar: we're both handling all buffering, playback, and sync directly. We use AVAssetReader to extract and then buffer frames on a background thread.
In our case, our code can operate both reading using CoreAudio (ExtAudioFileRef) or AVAssetReader. The two code paths have minimal differences, except for this crash.
Anyone out there have any further leads on this? I can't even start the process of trying to fix it because, although our customers hit it frequently, I can't seem to hit the race condition that causes the crash.
Thanks for any ideas, Chris
Our own stack traces to add to Michael's example:
Thread 9 Crashed:: AQClient
0 libobjc.A.dylib 0x00007fff8b5ab710 objc_msgSend_vtable13 + 16
1 com.apple.MediaToolbox 0x00007fff91d4bb19 0x7fff91d1a000 + 203545
2 com.apple.audio.toolbox.AudioToolbox 0x00007fff8d37058e ClientAudioQueue::PropertyChanged(unsigned int) + 228
3 com.apple.audio.toolbox.AudioToolbox 0x00007fff8d3007c0 AQClientCallbackMessageReader::DispatchCallbacks(unsigned char*, unsigned int, void*, unsigned int) + 166
4 com.apple.audio.toolbox.AudioToolbox 0x00007fff8d2ffd2f AQCallbackReceiver_CallbackNotificationsAvailable + 288
5 com.apple.audio.toolbox.AudioToolbox 0x00007fff8d2ffc04 _XCallbackNotificationsAvailable + 56
6 com.apple.audio.toolbox.AudioToolbox 0x00007fff8d2ff9f3 mshMIGPerform + 469
7 com.apple.CoreFoundation 0x00007fff939fdd09 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 41
8 com.apple.CoreFoundation 0x00007fff939fda49 __CFRunLoopDoSource1 + 153
9 com.apple.CoreFoundation 0x00007fff93a30c02 __CFRunLoopRun + 1826
10 com.apple.CoreFoundation 0x00007fff93a300e2 CFRunLoopRunSpecific + 290
11 com.apple.audio.toolbox.AudioToolbox 0x00007fff8d2e170e GenericRunLoopThread::Entry(void*) + 204
12 com.apple.audio.toolbox.AudioToolbox 0x00007fff8d2e15c5 CAPThread::Entry(CAPThread*) + 175
13 libsystem_c.dylib 0x00007fff91b767a2 _pthread_start + 327
14 libsystem_c.dylib 0x00007fff91b631e1 thread_start + 13
Thread 23 Crashed:: AQClient
0 libdispatch.dylib 0x00007fff8de22c28 dispatch_async_f + 3
1 com.apple.MediaToolbox 0x00007fff8f263b33 0x7fff8f232000 + 203571
2 com.apple.audio.toolbox.AudioToolbox 0x00007fff9682658e ClientAudioQueue::PropertyChanged(unsigned int) + 228
3 com.apple.audio.toolbox.AudioToolbox 0x00007fff967b67c0 AQClientCallbackMessageReader::DispatchCallbacks(unsigned char*, unsigned int, void*, unsigned int) + 166
4 com.apple.audio.toolbox.AudioToolbox 0x00007fff967b5d2f AQCallbackReceiver_CallbackNotificationsAvailable + 288
5 com.apple.audio.toolbox.AudioToolbox 0x00007fff967b5c04 _XCallbackNotificationsAvailable + 56
6 com.apple.audio.toolbox.AudioToolbox 0x00007fff967b59f3 mshMIGPerform + 469
7 com.apple.CoreFoundation 0x00007fff91394d09 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 41
8 com.apple.CoreFoundation 0x00007fff91394a49 __CFRunLoopDoSource1 + 153
9 com.apple.CoreFoundation 0x00007fff913c7c02 __CFRunLoopRun + 1826
10 com.apple.CoreFoundation 0x00007fff913c70e2 CFRunLoopRunSpecific + 290
11 com.apple.audio.toolbox.AudioToolbox 0x00007fff9679770e GenericRunLoopThread::Entry(void*) + 204
12 com.apple.audio.toolbox.AudioToolbox 0x00007fff967975c5 CAPThread::Entry(CAPThread*) + 175
13 libsystem_c.dylib 0x00007fff989e17a2 _pthread_start + 327
14 libsystem_c.dylib 0x00007fff989ce1e1 thread_start + 13
(etc)
On Oct 5, 2012, at 7:37 PM, Michael Miller < email@hidden> wrote: Hi all,
Something appears to have changed with 10.8.2. I'm seeing a lot of crashes in AudioQueues generated by AVAssetReader. Here's an example crash with the two relevant threads:
Thread 44: 0 libobjc.A.dylib 0x00007fff950e8f8d weak_entry_for_referent(weak_table_t*, objc_object*) + 224 1 libobjc.A.dylib 0x00007fff950e90c4 arr_clear_deallocating + 31 2 libobjc.A.dylib 0x00007fff950d29ee objc_clear_deallocating + 151 3 libobjc.A.dylib 0x00007fff950d2940 objc_destructInstance + 121 4 com.apple.CoreFoundation 0x00007fff94e88db5 CFRelease + 1541 5 com.apple.MediaToolbox 0x00007fff92c80411 0x7fff92b78000 + 1082385 6 com.apple.avfoundation 0x00007fff96e72433 -[AVAssetReader cancelReading] + 315 7 VideoLib.dylib 0x00000001019b0b87 GLUI::GLUIToggleButton::DoPress() + 12421 8 VideoLib.dylib 0x00000001019bb4c4 Video::SourceReader::SourceReader(boost::shared_ptr<Video::Source> const&, Video::MediaType, boost::optional<int> const&, boost::optional<double> const&) + 7938 9 com.motu.DigitalPerformer 0x000000010036a6e8 Dependent<MotuOSWindow::OSWindow_PlatformWindowListener>::RemoveProvider(Provider<MotuOSWindow::OSWindow_PlatformWindowListener>*) + 7886 10 com.motu.DigitalPerformer 0x000000010066329c Singleton<MotuMainThread>::Constructor::MakeInstance() + 7750 11 OSFoundation.dylib 0x00000001017cac77 MotuJobThread::MotuJobThread(UString const&, int) + 85 12 OSFoundation.dylib 0x00000001017cada6 MotuJobThread::MotuJobThread(UString const&, int) + 388 13 AllUtilities.dylib 0x00000001011132ad MotuThread::MotuThread(boost::shared_ptr<MotuThreadRoutine>, UString const&) + 195 14 libsystem_c.dylib 0x00007fff9451b742 _pthread_start + 327 15 libsystem_c.dylib 0x00007fff94508181 thread_start + 13
Thread 109 Crashed:: AQClient 0 libobjc.A.dylib 0x00007fff950d0710 objc_msgSend_vtable13 + 16 1 com.apple.MediaToolbox 0x00007fff92baa099 0x7fff92b78000 + 204953 2 com.apple.audio.toolbox.AudioToolbox 0x00007fff8b98e992 ClientAudioQueue::PropertyChanged(unsigned int) + 228 3 com.apple.audio.toolbox.AudioToolbox 0x00007fff8b91ecb0 AQClientCallbackMessageReader::DispatchCallbacks(unsigned char*, unsigned int, void*, unsigned int) + 166 4 com.apple.audio.toolbox.AudioToolbox 0x00007fff8b91e21f AQCallbackReceiver_CallbackNotificationsAvailable + 288 5 com.apple.audio.toolbox.AudioToolbox 0x00007fff8b91e0f4 _XCallbackNotificationsAvailable + 56 6 com.apple.audio.toolbox.AudioToolbox 0x00007fff8b91dee3 mshMIGPerform + 469 7 com.apple.CoreFoundation 0x00007fff94e822d9 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 41 8 com.apple.CoreFoundation 0x00007fff94e82019 __CFRunLoopDoSource1 + 153 9 com.apple.CoreFoundation 0x00007fff94eb519f __CFRunLoopRun + 1775 10 com.apple.CoreFoundation 0x00007fff94eb46b2 CFRunLoopRunSpecific + 290 11 com.apple.audio.toolbox.AudioToolbox 0x00007fff8b8ffc9c GenericRunLoopThread::Entry(void*) + 204 12 com.apple.audio.toolbox.AudioToolbox 0x00007fff8b8ffb53 CAPThread::Entry(CAPThread*) + 175 13 libsystem_c.dylib 0x00007fff9451b742 _pthread_start + 327 14 libsystem_c.dylib 0x00007fff94508181 thread_start + 13
On a hunch, I decided to try omitting the call to -[AVAssetReader cancelReading] but similar crashes resulted. In this case, rather than being caused by calling canceReading, we crash just after I've released my reference to the AVAssetReader.
Thread 55: 0 libobjc.A.dylib 0x00007fff92f97733 objc_autoreleasePoolPush + 35 1 com.apple.CoreFoundation 0x00007fff92d74918 _CFAutoreleasePoolPush + 24 2 com.apple.Foundation 0x00007fff92a40390 -[NSAutoreleasePool init] + 16 3 OSFoundation.dylib 0x0000000111b6a957 NS::AutoreleasePool::AutoreleasePool() + 45 4 VideoLib.dylib 0x0000000111e66ede AV::(anonymous namespace)::AVFoundationAssetTrack::GetTimeRange() const + 26 5 VideoLib.dylib 0x0000000111e6e297 Video::SourceReader::Impl::ResetReader(CMTime const&) + 211 6 VideoLib.dylib 0x0000000111e6dfbf Video::SourceReader::SeekToTime(Video::Time const&) + 453 7 VideoLib.dylib 0x0000000111e806c6 Video::(anonymous namespace)::BufferingRoutine::SeekToTimeAndFlush(double) + 136 8 com.motu.DigitalPerformer 0x000000010f897550 boost::function0<void>::operator()() const + 68 9 com.motu.DigitalPerformer 0x000000010f897434 MotuJobQueueTypedJob<void>::Run() + 24 10 VideoLib.dylib 0x0000000111e8170c Video::(anonymous namespace)::BufferingRoutine::MotuJobThread_RunLoopBody(blocking_queue<boost::shared_ptr<MotuJobQueueJob> >&) + 844 11 OSFoundation.dylib 0x0000000111b4f2bb (anonymous namespace)::MotuJobThreadRoutine::Run() + 251 12 AllUtilities.dylib 0x000000011110923b ThreadRoutineStarter(void*) + 266 13 libsystem_c.dylib 0x00007fff923e0742 _pthread_start + 327 14 libsystem_c.dylib 0x00007fff923cd181 thread_start + 13
Thread 56 Crashed:: AQClient 0 libdispatch.dylib 0x00007fff882dec28 dispatch_async_f + 3 1 com.apple.MediaToolbox 0x00007fff90a6f0b3 0x7fff90a3d000 + 204979 2 com.apple.audio.toolbox.AudioToolbox 0x00007fff89853992 ClientAudioQueue::PropertyChanged(unsigned int) + 228 3 com.apple.audio.toolbox.AudioToolbox 0x00007fff897e3cb0 AQClientCallbackMessageReader::DispatchCallbacks(unsigned char*, unsigned int, void*, unsigned int) + 166 4 com.apple.audio.toolbox.AudioToolbox 0x00007fff897e321f AQCallbackReceiver_CallbackNotificationsAvailable + 288 5 com.apple.audio.toolbox.AudioToolbox 0x00007fff897e30f4 _XCallbackNotificationsAvailable + 56 6 com.apple.audio.toolbox.AudioToolbox 0x00007fff897e2ee3 mshMIGPerform + 469 7 com.apple.CoreFoundation 0x00007fff92d472d9 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 41 8 com.apple.CoreFoundation 0x00007fff92d47019 __CFRunLoopDoSource1 + 153 9 com.apple.CoreFoundation 0x00007fff92d7a19f __CFRunLoopRun + 1775 10 com.apple.CoreFoundation 0x00007fff92d796b2 CFRunLoopRunSpecific + 290 11 com.apple.audio.toolbox.AudioToolbox 0x00007fff897c4c9c GenericRunLoopThread::Entry(void*) + 204 12 com.apple.audio.toolbox.AudioToolbox 0x00007fff897c4b53 CAPThread::Entry(CAPThread*) + 175 13 libsystem_c.dylib 0x00007fff923e0742 _pthread_start + 327 14 libsystem_c.dylib 0x00007fff923cd181 thread_start + 13
This seems like a pretty nasty race condition. Has anyone else seen anything like this? The crash only occurs on 10.8.2. Can anyone think of any workarounds?
Thanks! Michael Miller |