TheAmazingAudioEngine / TheAmazingAudioEngine2

The Amazing Audio Engine is a sophisticated framework for iOS audio applications, built so you don't have to.
http://theamazingaudioengine.com/doc2
Other
544 stars 87 forks source link

Thread sanitizer warning data race in AEManagedValueCommitPendingUpdates #50

Open jackpal opened 8 years ago

jackpal commented 8 years ago

Running my app on 64-bit simulator with the XCode 8.1 thread sanitizer turned on

I get this error when starting playback.

WARNING: ThreadSanitizer: data race (pid=11791) Write of size 1 at 0x000104a7aa20 by thread T38 (mutexes: write M18032, read M18717):

0 AEManagedValueCommitPendingUpdates AEManagedValue.m:257 (PlayMusic+0x0001016b7556)

#1 __38-[AEAudioUnitOutput initWithRenderer:]_block_invoke AEAudioUnitOutput.m:89 (PlayMusic+0x0001016d7238)
#2 AEIOAudioUnitRenderCallback AEIOAudioUnit.m:530 (PlayMusic+0x0001016e7058)
#3 AUConverterBase::RenderBus(unsigned int&, AudioTimeStamp const&, unsigned int, unsigned int) <null>:174 (AudioToolbox+0x00000012cee5)

Previous read of size 1 at 0x000104a7aa20 by thread T32:

0 -[AEManagedValue setValue:] AEManagedValue.m:204 (PlayMusic+0x0001016b6f01)

#1 -[AEManagedValue setObjectValue:] AEManagedValue.m:183 (PlayMusic+0x0001016b67d8)
#2 -[GPMAudioPlayerTrack createAudioBuffer] GPMAudioPlayerTrack.m:347 (PlayMusic+0x000100827469)
#3 -[GPMAudioPlayerTrack startRequest] GPMAudioPlayerTrack.m:464 (PlayMusic+0x00010082933f)
#4 __35-[GPMAudioPlayerTrack startRequest]_block_invoke.129 GPMAudioPlayerTrack.m:511 (PlayMusic+0x00010082a717)
#5 __60-[StreamFile serviceReadRequestsFromOffset:length:subStore:]_block_invoke.146 StreamFile.m:297 (PlayMusic+0x0001004eae75)
#6 __tsan::invoke_and_release_block(void*) <null>:226 (libclang_rt.tsan_iossim_dynamic.dylib+0x00000005c3fb)
#7 _dispatch_client_callout <null>:159 (libdispatch.dylib+0x00000002c0cc)

Location is global '__atomicUpdateWaitingForCommit' at 0x000104a7aa20 (PlayMusic+0x000101e39a20)

Mutex M18032 (0x7d68000bcc50) created at:

0 pthread_mutex_init :226 (libclang_rt.tsan_iossim_dynamic.dylib+0x000000024a93)

#1 CAMutex::CAMutex(char const*) <null>:174 (AudioToolbox+0x00000030d066)
#2 -[AEAudioUnitOutput start:] AEAudioUnitOutput.m:149 (PlayMusic+0x0001016d8035)
#3 __49-[GPMAudioPlayer initWithDelegate:delegateQueue:]_block_invoke GPMAudioPlayer.m:134 (PlayMusic+0x000100802e3b)
#4 -[GPMAudioPlayerModule setState:playbackError:] GPMAudioPlayerModule.m:620 (PlayMusic+0x00010081182e)
#5 __66-[GPMAudioPlayerModule playWithCompletionQueue:completionHandler:]_block_invoke GPMAudioPlayerModule.m:499 (PlayMusic+0x00010080daf9)
#6 __tsan::invoke_and_release_block(void*) <null>:226 (libclang_rt.tsan_iossim_dynamic.dylib+0x00000005c3fb)
#7 _dispatch_client_callout <null>:159 (libdispatch.dylib+0x00000002c0cc)

Mutex M18717 (0x000104a710c8) created at:

0 pthread_rwlock_tryrdlock :226 (libclang_rt.tsan_iossim_dynamic.dylib+0x0000000250be)

#1 AEManagedValueGetValue AEManagedValue.m:284 (PlayMusic+0x0001016b782c)
#2 AEIOAudioUnitRenderCallback AEIOAudioUnit.m:528 (PlayMusic+0x0001016e6fef)
#3 AUConverterBase::RenderBus(unsigned int&, AudioTimeStamp const&, unsigned int, unsigned int) <null>:174 (AudioToolbox+0x00000012cee5)

Thread T38 (tid=947078, running) created by thread T30 at:

0 pthread_create :226 (libclang_rt.tsan_iossim_dynamic.dylib+0x000000023b60)

#1 CAPThread::Start() <null>:174 (AudioToolbox+0x000000312a5c)
#2 -[AEAudioUnitOutput start:] AEAudioUnitOutput.m:152 (PlayMusic+0x0001016d80ce)
#3 __49-[GPMAudioPlayer initWithDelegate:delegateQueue:]_block_invoke GPMAudioPlayer.m:134 (PlayMusic+0x000100802e3b)
#4 -[GPMAudioPlayerModule setState:playbackError:] GPMAudioPlayerModule.m:620 (PlayMusic+0x00010081182e)
#5 __66-[GPMAudioPlayerModule playWithCompletionQueue:completionHandler:]_block_invoke GPMAudioPlayerModule.m:499 (PlayMusic+0x00010080daf9)
#6 __tsan::invoke_and_release_block(void*) <null>:226 (libclang_rt.tsan_iossim_dynamic.dylib+0x00000005c3fb)
#7 _dispatch_client_callout <null>:159 (libdispatch.dylib+0x00000002c0cc)

Thread T32 (tid=947021, running) created by thread T-1 [failed to restore the stack]

SUMMARY: ThreadSanitizer: data race AEManagedValue.m:257 in AEManagedValueCommitPendingUpdates

ThreadSanitizer report breakpoint hit. Use 'thread info -s' to get extended information about the report.