Audiokinetic's Community Q&A is the forum where users can ask and answer questions within the Wwise and Strata communities. If you would like to get an answer from Audiokinetic's Technical support team, make sure you use the Support Tickets page.

Unity hang after exiting play mode

+3 votes

Hi,

I was attempting to integrate wwise into a Unity project using Unity 2019.3.  I'm using Wwise 2019.2.0 build 7216.  Everything was going smoothly until I started testing in levels.  There are some levels where after testing in the editor, Wwise hangs and completely locks up Unity.  Looking at the call stack, it's here:

AkSoundEngine:ClearBanks ()+0x1 at D:\projects\XXX\Assets\Wwise\Deployment\API\Generated\Windows\AkSoundEngine_Windows.cs:[530:41-530:99]

AKRESULT AkSoundEngine:ClearBanks ()+0x1 at D:\projects\xxx\Assets\Wwise\Deployment\API\Generated\Windows\AkSoundEngine_Windows.cs:[530:41-530:99]

Void AkWwiseInitializationSettings:TerminateSoundEngine ()+0x18 at D:\projects\xxx\Assets\Wwise\Deployment\API\Handwritten\Common\AkWwiseInitializationSettings.cs:[385:3-385:30]

Void AkSoundEngineController:Terminate ()+0x17 at D:\projects\xxx\Assets\Wwise\Deployment\Components\AkSoundEngineController.cs:[148:3-148:56]

Void AkInitializer:OnApplicationQuit ()+0x15 at D:\projects\xxx\Assets\Wwise\Deployment\Components\AkInitializer.cs:[79:4-79:49]

This is happening 100% of the time on my level, both on OSX and in Windows.  I took a look at the process threads; it looks like the main unity thread may be waiting on thread Thread_193361 which is waiting for some other thread..

2180 Thread_193359
    + 2180 thread_start  (in libsystem_pthread.dylib) + 13  [0x7fff6fae340d]
    +   2180 _pthread_start  (in libsystem_pthread.dylib) + 66  [0x7fff6fae7249]
    +     2180 _pthread_body  (in libsystem_pthread.dylib) + 126  [0x7fff6fae42eb]
    +       2180 AK::StreamMgr::CAkIOThread::IOSchedThread(void*)  (in AkSoundEngine) + 75  [0x21753057b]
    +         2180 _pthread_cond_wait  (in libsystem_pthread.dylib) + 722  [0x7fff6fae756e]
    +           2180 __psynch_cvwait  (in libsystem_kernel.dylib) + 10  [0x7fff6fa28866]

    2180 Thread_193361
    + 2180 thread_start  (in libsystem_pthread.dylib) + 13  [0x7fff6fae340d]
    +   2180 _pthread_start  (in libsystem_pthread.dylib) + 66  [0x7fff6fae7249]
    +     2180 _pthread_body  (in libsystem_pthread.dylib) + 126  [0x7fff6fae42eb]
    +       2180 CAkThreadedBankMgr::BankThreadFunc(void*)  (in AkSoundEngine) + 56  [0x217651168]
    +         2180 CAkThreadedBankMgr::ExecuteCommand()  (in AkSoundEngine) + 227  [0x2176512e3]
    +           2180 CAkBankMgr::ExecuteCommand(CAkBankMgr::AkBankQueueItem&)  (in AkSoundEngine) + 661  [0x21759a385]
    +             2180 CAkBankMgr::ClearBanksInternal(CAkBankMgr::AkBankQueueItem)  (in AkSoundEngine) + 461  [0x21759b45d]
    +               2180 CAkBankMgr::KillSlotSync(CAkUsageSlot*)  (in AkSoundEngine) + 102  [0x21759e526]
    +                 2180 semaphore_wait_trap  (in libsystem_kernel.dylib) + 10  [0x7fff6fa25256]
    2180 Thread_193362
    + 2180 thread_start  (in libsystem_pthread.dylib) + 13  [0x7fff6fae340d]
    +   2180 _pthread_start  (in libsystem_pthread.dylib) + 66  [0x7fff6fae7249]
    +     2180 _pthread_body  (in libsystem_pthread.dylib) + 126  [0x7fff6fae42eb]
    +       2180 CAkOutputMgr::SuspendedThread(void*)  (in AkSoundEngine) + 59  [0x2175ef6fb]
    +         2180 semaphore_wait_trap  (in libsystem_kernel.dylib) + 10  [0x7fff6fa25256]
    2180 Thread_193363
    + 2180 thread_start  (in libsystem_pthread.dylib) + 13  [0x7fff6fae340d]
    +   2180 _pthread_start  (in libsystem_pthread.dylib) + 66  [0x7fff6fae7249]
    +     2180 _pthread_body  (in libsystem_pthread.dylib) + 126  [0x7fff6fae42eb]
    +       2180 CAkAudioThread::EventMgrThreadFunc(void*)  (in AkSoundEngine) + 56  [0x217658be8]
    +         2180 CAkAudioMgr::Perform()  (in AkSoundEngine) + 1069  [0x21758ee7d]
    +           2180 CAkURenderer::PerformContextNotif()  (in AkSoundEngine) + 234  [0x21765483a]
    +             2180 CAkPBI::Term(bool)  (in AkSoundEngine) + 231  [0x2175f2687]
    +               2180 CAkPlayingMgr::CheckRemovePlayingID(unsigned int, CAkPlayingMgr::PlayingMgrItem*)  (in AkSoundEngine) + 536  [0x217609208]
    +                 2180 AkCallbackSerializer::EventCallback(AkCallbackType, AkCallbackInfo*)  (in AkSoundEngine) + 302  [0x2174a8dee]
    +                   2180 AkSerializedEventCallbackInfo* AllocNewStruct<AkSerializedEventCallbackInfo>(bool, void*, unsigned int, unsigned int)  (in AkSoundEngine) + 243  [0x2174a92a3]
    +                     2180 semaphore_wait_trap  (in libsystem_kernel.dylib) + 10  [0x7fff6fa25256]

 

I'm not sure what to do from here.  Any help?

thanks,

sam

 

asked Feb 28, 2020 in General Discussion by Sam c. (140 points)

I'm still getting the same error with 2019.2.7.7402.1888.
It usually happens when the game is running and code is changed, forcing the engine to recompile. It hangs in the ResetSoundEngine call at ClearBanks ()

1 Answer

+1 vote
Definitely still an issue in 2020.2, happens when exiting play mode roughly 20% of the time for me. Forces me to terminate the Unity process and restart the Editor. Extremely annoying.
answered Mar 20, 2021 by Reinier V. (170 points)
...