Community Q&A

Welcome to Audiokinetic’s community-driven Q&A forum. This is the place where Wwise and Strata users help each other out. For direct help from our team, please use the Support Tickets page. To report a bug, use the Bug Report option in the Audiokinetic Launcher. (Note that Bug Reports submitted to the Q&A forum will be rejected. Using our dedicated Bug Report system ensures your report is seen by the right people and has the best chance of being fixed.)

To get the best answers quickly, follow these tips when posting a question:

  • Be Specific: What are you trying to achieve, or what specific issue are you running into?
  • Include Key Details: Include details like your Wwise and game engine versions, operating system, etc.
  • Explain What You've Tried: Let others know what troubleshooting steps you've already taken.
  • Focus on the Facts: Describe the technical facts of your issue. Focusing on the problem helps others find a solution quickly.

0 votes
We are experiencing recurrent deadlocks in our iOS application using Wwise version 2019.2 when set Wwise uMemAllocationSizeLimit  to 100M for memory optimism. We have captured logs and thread stacks for two different scenarios that lead to a complete application freeze. We would appreciate your insight into these issues.

Scenario 1: Deadlock between SetPosition and LoadBank
In this scenario, the application freezes due to a deadlock between a game thread calling AK::SoundEngine::SetPosition and a Wwise thread loading a SoundBank.

Analysis:

Thread 30 (Game Logic) gets stuck inside AK::SoundEngine::SetPosition. It appears to be waiting for a lock within CAkAudioMgr::ReserveQueue.
Thread 39 (Wwise Bank Loading) is simultaneously stuck inside CAkBankMgr::LoadBank while trying to acquire a lock in CAkBankMgr::ReadSourceParent.
We suspect a classic A-B/B-A deadlock, where the game thread has locked a resource within CAkAudioMgr and is waiting for the bank to load, while the bank loading thread has locked a resource in CAkBankMgr and is waiting for a resource from CAkAudioMgr.

Key Call Stacks for Scenario 1:

some log may helps:

 

AVAudioSessionClient_Common.mm:597   Failed to set properties, error: -50

AK Error: Vorbis decoder failure: 691920477

AK Error: Audio command queue is full, blocking caller.  Reduce number of calls to sound engine or boost command queue memory.

 

Thread 30 (Waiting in SetPosition)
#3  in __psynch_mutexwait ()
#4  in CAkAudioMgr::ReserveQueue at AkAudioMgr.cpp:428
#5  in AK::SoundEngine::SetPositionInternal at AkAudioLib.cpp:1366
#6  in AK::SoundEngine::SetPosition at AkAudioLib.cpp:1355
#7  in Messiah::SoundManagerWwise::_Tick_on_ot at SoundManagerWwise.cpp:680
...
1
2
3
4
5
6
Thread 39 (Waiting in LoadBank)

#3  in __psynch_mutexwait ()
#4  in CAkBankMgr::ReadSourceParent<CAkSound> at AkBankMgr.h:547
#5  in CAkBankMgr::ProcessHircChunk at AkBankMgr.cpp:2096
#6  in CAkBankMgr::LoadBank at AkBankMgr.cpp:889
#7  in CAkThreadedBankMgr::ExecuteCommand at AkThreadedBankMgr.cpp:193
#8  in CAkThreadedBankMgr::BankThreadFunc at AkThreadedBankMgr.cpp:134
...

Scenario 2: Deadlock Triggered by Memory Allocation Failure
This scenario also results in a deadlock, but it appears to be triggered by a memory allocation failure within the Wwise audio rendering thread.

Analysis:

Thread 39 (Wwise Audio Rendering) is stuck in AkMonitor::MonitorAllocFailure after a call to AK::MemoryMgr::Malloc failed during Opus stream decoding (CAkSrcFileOpus::SeekHelper). We believe the error handling path attempts to acquire a lock that is already held, causing it to freeze.
Thread 37 (Wwise Bank Loading) is stuck in the middle of a CAkBankMgr::LoadBank operation, holding a lock that Thread 39 is likely waiting for.
Thread 28 (Game Logic) is blocked on a synchronous call to AK::SoundEngine::UnloadBank. It is waiting for the bank manager thread (Thread 37), which is already deadlocked and cannot process the unload request.
The root cause appears to be memory exhaustion in the audio engine, which leads to a deadlock between the audio rendering thread and the bank manager thread during the error reporting process.

 

Key Call Stacks for Scenario 2:

some log may helps:

AVAudioSessionClient_Common.mm:597   Failed to set properties, error: -50

AK Error: ….

AK Error: Error while decoding Opus header.: 863644167

AK Error: Error while decoding Opus header.: 290020993

AK Error: Error while decoding Opus header.: 290020993

AK Error: Insufficient Space to Load Bank

AK Error: Bank Load Failed

 

Thread 39 (Stuck in Error Handling)
#1  in AkMonitor::MonitorAllocFailure at AkMonitor.cpp:183
#2  in AK::MemoryMgr::Malloc at AkMemoryMgrBase.cpp:395
#3  in ::AK_malloc at AkOpusLib.cpp:67
#4  in ogg_sync_buffer_AK at framing.c:647
#5  in op_get_next_page at opusfile.c:209
#6  in op_pcm_seek_AK at opusfile.c:2633
#7  in CAkSrcFileOpus::SeekHelper at AkSrcFileOpus.cpp:658
#8  in CAkLEngine::ProcessSources at AkLEngine_SoftwarePipeline.cpp:2585
#9  in CAkAudioMgr::Perform at AkAudioMgr.cpp:585
#10 in CAkAudioThread::EventMgrThreadFunc at AkAudioThread.cpp:66

Thread 37 (Waiting in LoadBank)

#3  in __psynch_mutexwait ()
#4  in CAkBankMgr::ReadSourceParent<CAkSound> at AkBankMgr.h:547
#5  in CAkBankMgr::ProcessHircChunk at AkBankMgr.cpp:2096
#6  in CAkBankMgr::LoadBank at AkBankMgr.cpp:889
#7  in CAkThreadedBankMgr::ExecuteCommand at AkThreadedBankMgr.cpp:193
#8  in CAkThreadedBankMgr::BankThreadFunc at AkThreadedBankMgr.cpp:134
...

Thread 28 (Waiting in UnloadBank)

 

#1  in semaphore_wait_trap ()
#2  in CAkThreadedBankMgr::WaitForSyncOp at AkThreadedBankMgr.cpp:177
#3  in AK::SoundEngine::UnloadBank at AkAudioLib.cpp:4302
#4  in Messiah::SoundManagerWwise::HandleLoadBankAsyncCallback at SoundManagerWwise.cpp:3256
...

Could you please let us know if these are known issues or if you have any recommendations for how to resolve or work around them? The memory allocation failure in the second scenario is particularly concerning.

Thank you for your time and assistance.
ago in General Discussion by aaron chen (100 points)

Please sign-in or register to answer this question.

...