[Linux] FMOD logging in Unity causes stack overflow

When I run my relatively heavy scene Unity crashes at runtime. Looking at the logs it seems to come from some kind of recursive logging loop in FMOD which causes a stack overflow.
I tried changing the log level to None or Error and then it doesn’t happen. on Warning it happens at some point at runtime (usually like 10 seconds in), and on Log it just crashes on launch.


context

I’m running

  • FMOD Unity and studio 2.03.12 (it also happens on 2.03.06)
  • Unity: 6000.3.2f1
  • OS: NixOS 25.11 (Linux kernel 6.18.1).

Also in Unity we’re working with Unity Entities which has required some workarounds to be able to use FMOD which could be a problem but so far hasn’t triggered this.

I’ve been working on this project for a while now and only recently this has become an issue. So the only direction I have is that there are just more calls happening at once, there’s no specific implementation I made that causes it with the testing I’ve done so far (which has only been on Linux right now).


Is this a known issue? I couldn’t find anything about it apart from this post some years back


Here’s the relevant part of the editor log:

(Filename: Assets/Plugins/FMOD/src/RuntimeUtils.cs Line: 564)

[FMOD] Thread::initThread : Init FMOD mixer thread. Affinity: 0x4000000000000001, Priority: 0xFFFF7FFA, Stack Size: 81920, Semaphore: No, Sleep Time: 0, Looping: Yes.
UnityEngine.Debug:ExtractStackTraceNoAlloc (byte*,int,string)
UnityEngine.StackTraceUtility:ExtractStackTrace () (at /home/bokken/build/output/unity/unity/Runtime/Export/Scripting/StackTrace.cs:35)
UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:Log (object)
FMODUnity.RuntimeUtils:DebugLog (string) (at Assets/Plugins/FMOD/src/RuntimeUtils.cs:564)
FMODUnity.RuntimeManager:DEBUG_CALLBACK (FMOD.DEBUG_FLAGS,intptr,int,intptr,intptr) (at Assets/Plugins/FMOD/src/RuntimeManager.cs:112)
FMOD.Studio.System:initialize (int,FMOD.Studio.INITFLAGS,FMOD.INITFLAGS,intptr) (at Assets/Plugins/FMOD/src/fmod_studio.cs:419)
FMODUnity.RuntimeManager:Initialize () (at Assets/Plugins/FMOD/src/RuntimeManager.cs:381)
FMODUnity.RuntimeManager:get_Instance () (at Assets/Plugins/FMOD/src/RuntimeManager.cs:212)
FMODUnity.RuntimeManager:HasBankLoaded (string) (at Assets/Plugins/FMOD/src/RuntimeManager.cs:1534)
Audio.MonoBehaviours.FMODAudioManager:InitializeBanksBlocking (Audio.Utils.AudioBank[]) (at Assets/Scripts/Audio/MonoBehaviours/FMODAudioManager.cs:40)
Audio.MonoBehaviours.FMODAudioManager:Awake () (at Assets/Scripts/Audio/MonoBehaviours/FMODAudioManager.cs:25)

(Filename: Assets/Plugins/FMOD/src/RuntimeUtils.cs Line: 564)

StackOverflowException: The requested operation caused a stack overflow.
  at UnityEngine.StackTraceUtility.ExtractStackTrace () [0x00007] in /home/bokken/build/output/unity/unity/Runtime/Export/Scripting/StackTrace.cs:33 
  at (wrapper managed-to-native) UnityEngine.DebugLogHandler.Internal_Log_Injected(UnityEngine.LogType,UnityEngine.LogOption,UnityEngine.Bindings.ManagedSpanWrapper&,intptr)
  at UnityEngine.DebugLogHandler.Internal_Log (UnityEngine.LogType level, UnityEngine.LogOption options, System.String msg, UnityEngine.Object obj) [0x00034] in <47cff71b0b7749a79b626569f499a43b>:0 
  at UnityEngine.DebugLogHandler.LogFormat (UnityEngine.LogType logType, UnityEngine.Object context, System.String format, System.Object[] args) [0x00001] in /home/bokken/build/output/unity/unity/Runtime/Export/Logging/DebugLogHandler.cs:9 
  at UnityEngine.Logger.Log (UnityEngine.LogType logType, System.Object message) [0x0000c] in /home/bokken/build/output/unity/unity/Runtime/Export/Logging/Logger.cs:60 
  at UnityEngine.Debug.Log (System.Object message) [0x00001] in /home/bokken/build/output/unity/unity/Runtime/Export/Debug/Debug.bindings.cs:123 
  at FMODUnity.RuntimeUtils.DebugLog (System.String message) [0x00014] in /home/subnite/dev/unity/Project-Name/Assets/Plugins/FMOD/src/RuntimeUtils.cs:564 
  at FMODUnity.RuntimeManager.DEBUG_CALLBACK (FMOD.DEBUG_FLAGS flags, System.IntPtr filePtr, System.Int32 line, System.IntPtr funcPtr, System.IntPtr messagePtr) [0x00066] in /home/subnite/dev/unity/Project-Name/Assets/Plugins/FMOD/src/RuntimeManager.cs:112 
  at (wrapper native-to-managed) FMODUnity.RuntimeManager.DEBUG_CALLBACK(FMOD.DEBUG_FLAGS,intptr,int,intptr,intptr)
UnityEngine.DebugLogHandler:Internal_LogException_Injected(Exception, IntPtr)
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
UnityEngine.<>c:<RegisterUECatcher>b__0_0(Object, UnhandledExceptionEventArgs) (at /home/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnhandledExceptionHandler.bindings.cs:46)
UnityEngine.DebugLogHandler:Internal_Log_Injected(LogType, LogOption, ManagedSpanWrapper&, IntPtr)
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
FMODUnity.RuntimeUtils:DebugLog(String) (at Assets/Plugins/FMOD/src/RuntimeUtils.cs:564)
FMODUnity.RuntimeManager:DEBUG_CALLBACK(DEBUG_FLAGS, IntPtr, Int32, IntPtr, IntPtr) (at Assets/Plugins/FMOD/src/RuntimeManager.cs:112)

(Filename: Assets/Plugins/FMOD/src/RuntimeUtils.cs Line: 564)

StackOverflowException: The requested operation caused a stack overflow.
  at Unity.PlasticSCM.Editor.PlasticApp.HandleUnhandledException (System.Object sender, System.UnhandledExceptionEventArgs args) [0x0004e] in ./Library/PackageCache/com.unity.collab-proxy@3351acaba9c9/Editor/PlasticApp.cs:257 
  at (wrapper delegate-invoke) <Module>.invoke_void_object_UnhandledExceptionEventArgs(object,System.UnhandledExceptionEventArgs)
  at (wrapper managed-to-native) UnityEngine.DebugLogHandler.Internal_Log_Injected(UnityEngine.LogType,UnityEngine.LogOption,UnityEngine.Bindings.ManagedSpanWrapper&,intptr)
  at UnityEngine.DebugLogHandler.Internal_Log (UnityEngine.LogType level, UnityEngine.LogOption options, System.String msg, UnityEngine.Object obj) [0x00034] in <47cff71b0b7749a79b626569f499a43b>:0 
  at UnityEngine.DebugLogHandler.LogFormat (UnityEngine.LogType logType, UnityEngine.Object context, System.String format, System.Object[] args) [0x00001] in /home/bokken/build/output/unity/unity/Runtime/Export/Logging/DebugLogHandler.cs:9 
  at UnityEngine.Logger.Log (UnityEngine.LogType logType, System.Object message) [0x0000c] in /home/bokken/build/output/unity/unity/Runtime/Export/Logging/Logger.cs:60 
  at UnityEngine.Debug.Log (System.Object message) [0x00001] in /home/bokken/build/output/unity/unity/Runtime/Export/Debug/Debug.bindings.cs:123 
  at FMODUnity.RuntimeUtils.DebugLog (System.String message) [0x00014] in /home/subnite/dev/unity/Project-Name/Assets/Plugins/FMOD/src/RuntimeUtils.cs:564 
  at FMODUnity.RuntimeManager.DEBUG_CALLBACK (FMOD.DEBUG_FLAGS flags, System.IntPtr filePtr, System.Int32 line, System.IntPtr funcPtr, System.IntPtr messagePtr) [0x00066] in /home/subnite/dev/unity/Project-Name/Assets/Plugins/FMOD/src/RuntimeManager.cs:112 
  at (wrapper native-to-managed) FMODUnity.RuntimeManager.DEBUG_CALLBACK(FMOD.DEBUG_FLAGS,intptr,int,intptr,intptr)
UnityEngine.DebugLogHandler:Internal_LogException_Injected(Exception, IntPtr)
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
UnityEngine.<>c:<RegisterUECatcher>b__0_0(Object, UnhandledExceptionEventArgs) (at /home/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnhandledExceptionHandler.bindings.cs:46)
UnityEngine.DebugLogHandler:Internal_Log_Injected(LogType, LogOption, ManagedSpanWrapper&, IntPtr)
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
FMODUnity.RuntimeUtils:DebugLog(String) (at Assets/Plugins/FMOD/src/RuntimeUtils.cs:564)
FMODUnity.RuntimeManager:DEBUG_CALLBACK(DEBUG_FLAGS, IntPtr, Int32, IntPtr, IntPtr) (at Assets/Plugins/FMOD/src/RuntimeManager.cs:112)

(Filename: Assets/Plugins/FMOD/src/RuntimeUtils.cs Line: 564)

Stack overflow: IP: 0x7f8bf3a77da0, fault addr: 0x7f8cc4677bb8
Stacktrace:
  at <unknown> <0xffffffff>
  at System.Text.StringBuilder.ExpandByABlock (int) [0x00080] in <1a795a29c7af4385b159eb69f68237b8>:0
  <...>
  at System.Text.StringBuilder.Append (char*,int) [0x000a5] in <1a795a29c7af4385b159eb69f68237b8>:0
  at System.Text.StringBuilder.AppendHelper (string) [0x00018] in <1a795a29c7af4385b159eb69f68237b8>:0
  at System.Text.StringBuilder.Append (string) [0x00085] in <1a795a29c7af4385b159eb69f68237b8>:0
  at System.Text.StringBuilder.AppendFormatHelper (System.IFormatProvider,string,System.ParamsArray) [0x003b5] in <1a795a29c7af4385b159eb69f68237b8>:0
  at System.Text.StringBuilder.AppendFormat (string,object,object) [0x0000a] in <1a795a29c7af4385b159eb69f68237b8>:0
  at System.Diagnostics.StackTrace.AddFrames (System.Text.StringBuilder,bool,bool&) [0x0017a] in <1a795a29c7af4385b159eb69f68237b8>:0
  at System.Diagnostics.StackTrace.ToString () [0x00062] in <1a795a29c7af4385b159eb69f68237b8>:0
  at System.Diagnostics.StackTrace.ToString (System.Diagnostics.StackTrace/TraceFormat) [0x00001] in <1a795a29c7af4385b159eb69f68237b8>:0
  at System.Environment.GetStackTrace (System.Exception,bool) [0x00016] in <1a795a29c7af4385b159eb69f68237b8>:0
  at System.Exception.GetStackTrace (bool) [0x0003a] in <1a795a29c7af4385b159eb69f68237b8>:0
  at System.Exception.get_StackTrace () [0x00002] in <1a795a29c7af4385b159eb69f68237b8>:0
  at UnityEngine.StackTraceUtility.ExtractStringFromExceptionInternal (object,string&,string&) [0x00032] in /home/bokken/build/output/unity/unity/Runtime/Export/Scripting/StackTrace.cs:62
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object_intptr&_intptr& (object,intptr,intptr,intptr) [0x00037] in <47cff71b0b7749a79b626569f499a43b>:0
  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) UnityEngine.DebugLogHandler.Internal_LogException_Injected (System.Exception,intptr) [0x00008] in <47cff71b0b7749a79b626569f499a43b>:0
  at UnityEngine.DebugLogHandler.Internal_LogException (System.Exception,UnityEngine.Object) [0x00007] in <47cff71b0b7749a79b626569f499a43b>:0
  at UnityEngine.DebugLogHandler.LogException (System.Exception,UnityEngine.Object) [0x00014] in /home/bokken/build/output/unity/unity/Runtime/Export/Logging/DebugLogHandler.cs:22
  at UnityEngine.Logger.LogException (System.Exception,UnityEngine.Object) [0x0000b] in /home/bokken/build/output/unity/unity/Runtime/Export/Logging/Logger.cs:132
  at UnityEngine.Debug.LogException (System.Exception) [0x00001] in /home/bokken/build/output/unity/unity/Runtime/Export/Debug/Debug.bindings.cs:202
  at UnityEngine.UnhandledExceptionHandler/<>c.<RegisterUECatcher>b__0_0 (object,System.UnhandledExceptionEventArgs) [0x00001] in /home/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnhandledExceptionHandler.bindings.cs:46
  at (wrapper delegate-invoke) <Module>.invoke_void_object_UnhandledExceptionEventArgs (object,System.UnhandledExceptionEventArgs) [0x00077] in <1a795a29c7af4385b159eb69f68237b8>:0
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object_object (object,intptr,intptr,intptr) [0x00033] in <1a795a29c7af4385b159eb69f68237b8>:0
  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) UnityEngine.DebugLogHandler.Internal_Log_Injected (UnityEngine.LogType,UnityEngine.LogOption,UnityEngine.Bindings.ManagedSpanWrapper&,intptr) [0x0000a] in <47cff71b0b7749a79b626569f499a43b>:0
  at UnityEngine.DebugLogHandler.Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object) [0x00034] in <47cff71b0b7749a79b626569f499a43b>:0
  at UnityEngine.DebugLogHandler.LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[]) [0x00001] in /home/bokken/build/output/unity/unity/Runtime/Export/Logging/DebugLogHandler.cs:9
  at UnityEngine.Logger.Log (UnityEngine.LogType,object) [0x0000c] in /home/bokken/build/output/unity/unity/Runtime/Export/Logging/Logger.cs:60
  at UnityEngine.Debug.Log (object) [0x00001] in /home/bokken/build/output/unity/unity/Runtime/Export/Debug/Debug.bindings.cs:123
  at FMODUnity.RuntimeUtils.DebugLog (string) [0x00014] in /home/subnite/dev/unity/Project-Name/Assets/Plugins/FMOD/src/RuntimeUtils.cs:564
  at FMODUnity.RuntimeManager.DEBUG_CALLBACK (FMOD.DEBUG_FLAGS,intptr,int,intptr,intptr) [0x00066] in /home/subnite/dev/unity/Project-Name/Assets/Plugins/FMOD/src/RuntimeManager.cs:112
  at (wrapper native-to-managed) FMODUnity.RuntimeManager.DEBUG_CALLBACK (FMOD.DEBUG_FLAGS,intptr,int,intptr,intptr) [0x00038] in <b7f95691d6b740cda873af658ad7df61>:0
e[40me[32minfoe[39me[22me[49m: Microsoft.Hosting.Lifetime[0]
      Application is shutting down...
e[40me[32minfoe[39me[22me[49m: Unity.ILPP.Runner.PostProcessingAssemblyLoadContext[0]
      ALC ILPP context 1 is unloading