Community Q&A

Where Wwise users help each other out!

Audiokinetic's Community Q&A is the forum where Wwise users ask and answer questions within the Wwise community. Contact Sales if your project requires a support plan.

unity crash when exit the application in play-in-editor using AkTerminator.cs

+4 votes
this is the dump, how can I resolve it?

AkSoundEngine.dll!tlsf_free(void * tlsf, void * ptr) 行 1034    C++
AkSoundEngine.dll!AK::MemoryMgr::Free(long in_PoolId, void * in_pvMemAddress) 行 593    C++
AkSoundEngine.dll!AK::SoundEngine::Term() 行 690    C++
AkSoundEngine.dll!Term() 行 466    C++
asked Apr 16 in General Discussion by evan c. (140 points)

3 Answers

+2 votes

There is the full stack from Unity 5.6.1f1 and Wwise 2016.2.2. We are facing the exact same issue since months and it occurs really often after hitting stop in the editor.

========== OUTPUTING STACK TRACE ==================

0x00007FF8FAF8C68B (AkSoundEngine) AK::MemoryMgr::Term
0x00007FF8FAF8B639 (AkSoundEngine) AK::MemoryMgr::Free
0x00007FF8FAEB80A3 (AkSoundEngine) AK::SoundEngine::Term
  ERROR: SymGetSymFromAddr64, GetLastError: 'Tentative d’accès à une adresse non valide.' (Address: 00007FF8FAEA4A99)
0x00007FF8FAEA4A99 (AkSoundEngine)
0x00000000311E631D (Mono JIT Code) (wrapper managed-to-native) AkSoundEnginePINVOKE:CSharp_Term ()
0x00000000311E61FF (Mono JIT Code) [C:\Depots\PaperBeast\Assets\Standard Assets\ThirdParty\Wwise\Deployment\API\Generated\Windows\AkSoundEngine_Windows.cs:2474] AkSoundEngine:Term ()
0x00000000311E4AE4 (Mono JIT Code) [C:\Depots\PaperBeast\Assets\Standard Assets\ThirdParty\Wwise\Deployment\Components\AkTerminator.cs:93] AkTerminator:Terminate ()
0x00000000311E414C (Mono JIT Code) [C:\Depots\PaperBeast\Assets\Standard Assets\ThirdParty\Wwise\Deployment\Components\AkTerminator.cs:43] AkTerminator:OnApplicationQuit ()
0x0000000000947112 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
0x00007FF8E3675737 (mono) [c:\buildslave\mono\build\mono\mini\mini.c:4937] mono_jit_runtime_invoke
0x00007FF8E35C8435 (mono) [c:\buildslave\mono\build\mono\metadata\object.c:2623] mono_runtime_invoke
0x00000001410645B5 (Unity) scripting_method_invoke
0x0000000141059DF1 (Unity) ScriptingInvocation::Invoke
0x000000014149D769 (Unity) MonoBehaviour::HandleNotifications
0x0000000140906FA0 (Unity) GameObject::SendMessageAny
0x0000000140D5C768 (Unity) SendMessageToEveryone
0x000000014148121F (Unity) NotifyPlayerQuit
0x0000000141724421 (Unity) Application::ExitPlayMode
0x00000001417248B3 (Unity) Application::SetIsPlaying
0x0000000141725412 (Unity) Application::TickTimer
0x00000001417F0ABC (Unity) CrashCallback
0x00000001417F2704 (Unity) WinMain
0x0000000141AD7444 (Unity) strnlen
0x00007FF92B372774 (KERNEL32) BaseThreadInitThunk
0x00007FF92D710D61 (ntdll) RtlUserThreadStart

========== END OF STACKTRACE ===========
answered Jun 2 by Sébastien C. (760 points)
We're experiencing the same thing; frequent crashes when using the stop button in editor. We're using Unity 5.6.1p1 and Wwise v2016.2.3.

Here's our stack trace:

========== OUTPUTING STACK TRACE ==================

0x00007FF89179C73B (AkSoundEngine) AK::MemoryMgr::Term
0x00007FF89179B6E9 (AkSoundEngine) AK::MemoryMgr::Free
0x00007FF8916C81F3 (AkSoundEngine) AK::SoundEngine::Term
  ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FF8916B4BB9)
0x00007FF8916B4BB9 (AkSoundEngine)
0x0000000068D88D4D (Mono JIT Code) (wrapper managed-to-native) AkSoundEnginePINVOKE:CSharp_Term ()
0x0000000068D88C2A (Mono JIT Code) [C:\Dev\Fortune\Trunk\Client\Assets\Wwise\Deployment\API\Generated\Windows\AkSoundEngine_Windows.cs:2446] AkSoundEngine:Term ()
0x0000000068D86FD0 (Mono JIT Code) [C:\Dev\Fortune\Trunk\Client\Assets\Wwise\Deployment\Components\AkTerminator.cs:93] AkTerminator:Terminate ()
0x0000000068D86847 (Mono JIT Code) [C:\Dev\Fortune\Trunk\Client\Assets\Wwise\Deployment\Components\AkTerminator.cs:43] AkTerminator:OnApplicationQuit ()
0x0000000012647382 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
0x00007FF894565737 (mono) [c:\buildslave\mono\build\mono\mini\mini.c:4937] mono_jit_runtime_invoke
0x00007FF8944B8435 (mono) [c:\buildslave\mono\build\mono\metadata\object.c:2623] mono_runtime_invoke
0x00000001410688B5 (Unity) scripting_method_invoke
0x000000014105E1A1 (Unity) ScriptingInvocation::Invoke
0x00000001414A4629 (Unity) MonoBehaviour::HandleNotifications
0x0000000140906DF0 (Unity) GameObject::SendMessageAny
0x0000000140D60308 (Unity) SendMessageToEveryone
0x000000014148835F (Unity) NotifyPlayerQuit
0x000000014172C4D1 (Unity) Application::ExitPlayMode
0x000000014172C963 (Unity) Application::SetIsPlaying
0x000000014172D4C2 (Unity) Application::TickTimer
0x00000001417F94DC (Unity) CrashCallback
0x00000001417FB124 (Unity) WinMain
0x0000000141AE063C (Unity) strnlen
0x00007FF8C3E08364 (KERNEL32) BaseThreadInitThunk
0x00007FF8C41770D1 (ntdll) RtlUserThreadStart

========== END OF STACKTRACE ===========
And the issue is present since december, still without any official answer :
0 votes
Not sure if this will help with your issue, but for us it turned out that there was a second AkInitializer being created sometimes when the editor was exiting. I added a breakpoint in AkInitializer.Initialise() and saw that we had a lazy initiializer which was recreating our AudioManager object  within an OnDisable() method of a MonoBehaviour. According to Audiokinetic such a call-stack can be indicative of having two such objects.

Also double check that you're either using the WwiseGlobal game object or creating your own AkInitializer and not both.
answered Jul 24 by PeteGunterMediatonic (170 points)
0 votes
Ok, I found a fix for this crash!

Add this in AKTerminator.cs:

    void OnEnable()
        //The sound engine was not terminated normally.  Make this instance the one that will manage termination.
        //This happen when Unity resets everything when a script changes.
        if (ms_Instance == null && AkSoundEngine.IsInitialized())
            ms_Instance = this;
answered Sep 26 by Olivier F. (210 points)