FMOD fails only building on batch mode in Docker Windows container

We are facing an issue when building on our pipeline using a Gitlab-Runner with a Docker Windows executor.

I have managed to reproduce the issue in a small sample project that only includes the fmod library.

The issue happens when I try to run a job with a Gitlab Runner on a Docker Windows container based on a Game-CI image.

The build fails with the following log:

Application.AssetDatabase Initial Refresh End
Scanning for USB devices : 0.991ms
Initializing Unity extensions:
.[MODES] ModeService[none].Initialize
[MODES] ModeService[none].LoadModes
[MODES] Loading mode Default (0) for mode-current-id-gitlabrunnertest
ProgressiveSceneManager::Cancel()
Unloading 114 Unused Serialized files (Serialized files now loaded: 0)
Unloading 204 unused Assets / (494.8 KB). Loaded Objects now: 3484.
Memory consumption went from 79.8 MB to 79.4 MB.
Total: 6.145500 ms (FindLiveObjects: 0.559300 ms CreateObjectMapping: 0.414300 ms MarkObjects: 4.698000 ms  DeleteObjects: 0.472200 ms)

Fallback handler could not load library C:/Program Files/Unity/Hub/Editor/2021.3.28f1/Editor/Data/MonoBleedingEdge/lib/fmodstudioL
Fallback handler could not load library C:/Program Files/Unity/Hub/Editor/2021.3.28f1/Editor/Data/MonoBleedingEdge/lib/fmodstudioL.dll
Fallback handler could not load library C:/Program Files/Unity/Hub/Editor/2021.3.28f1/Editor/Data/MonoBleedingEdge/lib/fmodstudioL.dll
Fallback handler could not load library C:/Program Files/Unity/Hub/Editor/2021.3.28f1/Editor/Data/MonoBleedingEdge/lib/fmodstudioL
Fallback handler could not load library C:/Program Files/Unity/Hub/Editor/2021.3.28f1/Editor/Data/MonoBleedingEdge/lib/libfmodstudioL
Fallback handler could not load library C:/Program Files/Unity/Hub/Editor/2021.3.28f1/Editor/Data/MonoBleedingEdge/lib/libfmodstudioL.dll
Fallback handler could not load library C:/Program Files/Unity/Hub/Editor/2021.3.28f1/Editor/Data/MonoBleedingEdge/lib/libfmodstudioL.dll
Fallback handler could not load library C:/Program Files/Unity/Hub/Editor/2021.3.28f1/Editor/Data/MonoBleedingEdge/lib/libfmodstudioL
Fallback handler could not load library C:/Program Files/Unity/Hub/Editor/2021.3.28f1/Editor/Data/MonoBleedingEdge/lib/fmodstudioL
Fallback handler could not load library C:/Program Files/Unity/Hub/Editor/2021.3.28f1/Editor/Data/MonoBleedingEdge/lib/fmodstudioL.dll
Fallback handler could not load library C:/Program Files/Unity/Hub/Editor/2021.3.28f1/Editor/Data/MonoBleedingEdge/lib/fmodstudioL.dll
Fallback handler could not load library C:/Program Files/Unity/Hub/Editor/2021.3.28f1/Editor/Data/MonoBleedingEdge/lib/fmodstudioL
Fallback handler could not load library C:/Program Files/Unity/Hub/Editor/2021.3.28f1/Editor/Data/MonoBleedingEdge/lib/libfmodstudioL
Fallback handler could not load library C:/Program Files/Unity/Hub/Editor/2021.3.28f1/Editor/Data/MonoBleedingEdge/lib/libfmodstudioL.dll
Fallback handler could not load library C:/Program Files/Unity/Hub/Editor/2021.3.28f1/Editor/Data/MonoBleedingEdge/lib/libfmodstudioL.dll
Fallback handler could not load library C:/Program Files/Unity/Hub/Editor/2021.3.28f1/Editor/Data/MonoBleedingEdge/lib/libfmodstudioL
DllNotFoundException: fmodstudioL assembly:<unknown assembly> type:<unknown type> member:(null)
  at (wrapper managed-to-native) FMOD.Memory.FMOD5_Memory_GetStats(int&,int&,bool)
  at FMOD.Memory.GetStats (System.Int32& currentalloced, System.Int32& maxalloced, System.Boolean blocking) [0x00000] in C:\builds\moctezumadev\gitlabrunnertest\Assets\Plugins\FMOD\src\fmod.cs:991
  at FMODUnity.RuntimeUtils.EnforceLibraryOrder () [0x00000] in C:\builds\moctezumadev\gitlabrunnertest\Assets\Plugins\FMOD\src\RuntimeUtils.cs:543
  at FMODUnity.EditorUtils.CreateSystem () [0x0000a] in C:\builds\moctezumadev\gitlabrunnertest\Assets\Plugins\FMOD\src\Editor\EditorUtils.cs:510
  at FMODUnity.EditorUtils.get_System () [0x0000c] in C:\builds\moctezumadev\gitlabrunnertest\Assets\Plugins\FMOD\src\Editor\EditorUtils.cs:597
  at FMODUnity.EventManager.UpdateCache () [0x00269] in C:\builds\moctezumadev\gitlabrunnertest\Assets\Plugins\FMOD\src\Editor\EventManager.cs:179
  at FMODUnity.EventManager.RefreshBanks () [0x00000] in C:\builds\moctezumadev\gitlabrunnertest\Assets\Plugins\FMOD\src\Editor\EventManager.cs:33
  at FMODUnity.EventManager.BuildTargetChanged () [0x00000] in C:\builds\moctezumadev\gitlabrunnertest\Assets\Plugins\FMOD\src\Editor\EventManager.cs:1045
  at FMODUnity.EventManager+<>c.<.cctor>b__16_0 () [0x00000] in C:\builds\moctezumadev\gitlabrunnertest\Assets\Plugins\FMOD\src\Editor\EventManager.cs:571
  at FMODUnity.BuildStatusWatcher.SetBuildInProgress (System.Boolean inProgress) [0x0003c] in C:\builds\moctezumadev\gitlabrunnertest\Assets\Plugins\FMOD\src\Editor\EditorUtils.cs:1669
  at FMODUnity.BuildStatusWatcher+BuildProcessor.OnPreprocessBuild (UnityEditor.Build.Reporting.BuildReport report) [0x00000] in C:\builds\moctezumadev\gitlabrunnertest\Assets\Plugins\FMOD\src\Editor\EditorUtils.cs:1695
  at UnityEditor.Build.BuildPipelineInterfaces+<>c__DisplayClass16_0.<OnBuildPreProcess>b__1 (UnityEditor.Build.IPreprocessBuildWithReport bpp) [0x00000] in <308d48a21a3e462ba091bd758b25b1e6>:0
  at UnityEditor.Build.BuildPipelineInterfaces.InvokeCallbackInterfacesPair[T1,T2] (System.Collections.Generic.List`1[T] oneInterfaces, System.Action`1[T] invocationOne, System.Collections.Generic.List`1[T] twoInterfaces, System.Action`1[T] invocationTwo, System.Boolean exitOnFailure) [0x000ff] in <308d48a21a3e462ba091bd758b25b1e6>:0
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
UnityEditor.Build.BuildPipelineInterfaces:InvokeCallbackInterfacesPair(List`1, Action`1, List`1, Action`1, Boolean)
UnityEditor.Build.BuildPipelineInterfaces:OnBuildPreProcess(BuildReport)
UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck(String[], String, String, BuildTargetGroup, BuildTarget, Int32, BuildOptions, String[], Boolean)
UnityEditor.BuildPipeline:BuildPlayerInternal(String[], String, String, BuildTargetGroup, BuildTarget, Int32, BuildOptions, String[])
UnityEditor.BuildPipeline:BuildPlayer(String[], String, String, BuildTargetGroup, BuildTarget, Int32, BuildOptions, String[])
UnityEditor.BuildPipeline:BuildPlayer(BuildPlayerOptions)
UnityEditor.BuildPipeline:BuildPlayer(String[], String, BuildTarget, BuildOptions)
Builder:Build() (at Assets\BuildPipeline\Editor\Builder.cs:19)

(Filename: Assets/Plugins/FMOD/src/fmod.cs Line: 991)

DisplayProgressNotification: Build Failed
Error building Player: DllNotFoundException: fmodstudioL assembly:<unknown assembly> type:<unknown type> member:(null)
Unloading 78 Unused Serialized files (Serialized files now loaded: 0)
Unloading 75 unused Assets / (23.0 KB). Loaded Objects now: 3506.
Memory consumption went from 78.2 MB to 78.2 MB.
Total: 6.078000 ms (FindLiveObjects: 0.585500 ms CreateObjectMapping: 0.376400 ms MarkObjects: 5.051600 ms  DeleteObjects: 0.063000 ms)

Build Finished, Result: Failure.
Batchmode quit successfully invoked - shutting down!

I was able to reproduce this issue in different versions of Unity and FMOD with target Win64.

The build only fails on batchmode and when it is executed in the container.

Unity
2021.3.28f1
2021.3.15f1

FMOD for Unity
2.02.13
2.02.09

Docker
version 24.0.4, build 3713ee1

Gitlab-Runner
Version: 16.2.0
Git revision: 782e15da
Git branch: 16-2-stable
GO version: go1.20.5
Built: 2023-07-21T22:53:19+0000
OS/Arch: windows/amd64

GameCI Editor Images
unityci/editor:windows-2021.3.28f1-windows-il2cpp-1.1.2
unityci/editor:windows-2021.3.15f1-windows-il2cpp-1.1.2

Attachments
Dokerfile to build the Docker Image
Gitlab Runner Full Log
Source Code of Sample project without FMOD for Unity (just download it and import it)
config.toml used to config the Gitlab Runner Docker executor.

FMOD Forum post:

9200386–1283238–gitlabrunnertest-main.zip (243 KB)
9200386–1283240–config.toml.txt (772 Bytes)
9200386–1283242–Dockerfile.txt (249 Bytes)
9200386–1283244–gitlab-runner-log.txt (126 KB)

1 Like

Ok part of the issue is gone, it was actually a DLL missing in the docker image.

9203103--1283775--upload_2023-8-8_19-51-5.png

I catched this thanks to an old thread which where someone was having also an issue with a DLL

Now I have other issue still related to FMOD

FMOD Studio: Encountered Error: ERR_OUTPUT_INIT Error initializing output device.

(Filename: Assets/Assemblies/Thirdparty/FMOD/src/RuntimeUtils.cs Line: 585)

FMOD Studio: Encountered Error: ERR_INVALID_HANDLE An invalid object handle was used.

(Filename: Assets/Assemblies/Thirdparty/FMOD/src/RuntimeUtils.cs Line: 585)

FMOD Studio: Encountered Error: ERR_INVALID_PARAM An invalid parameter was passed to this function.

(Filename: Assets/Assemblies/Thirdparty/FMOD/src/RuntimeUtils.cs Line: 585)

FMOD Studio: Encountered Error: ERR_INVALID_HANDLE An invalid object handle was used.

(Filename: Assets/Assemblies/Thirdparty/FMOD/src/RuntimeUtils.cs Line: 585)

FMOD Studio: Encountered Error: ERR_INVALID_PARAM An invalid parameter was passed to this function.

(Filename: Assets/Assemblies/Thirdparty/FMOD/src/RuntimeUtils.cs Line: 585)

FMOD Studio: Encountered Error: ERR_INVALID_PARAM An invalid parameter was passed to this function.

(Filename: Assets/Assemblies/Thirdparty/FMOD/src/RuntimeUtils.cs Line: 585)

FMOD Studio: Encountered Error: ERR_INVALID_PARAM An invalid parameter was passed to this function.

(Filename: Assets/Assemblies/Thirdparty/FMOD/src/RuntimeUtils.cs Line: 585)

FMOD Studio: Encountered Error: ERR_INVALID_HANDLE An invalid object handle was used.

(Filename: Assets/Assemblies/Thirdparty/FMOD/src/RuntimeUtils.cs Line: 585)

FMOD: Bank refresh failed: FMODBanks/Desktop\Master.strings.bank is not a valid bank.

(Filename: Assets/Assemblies/Thirdparty/FMOD/src/RuntimeUtils.cs Line: 593)

DisplayProgressNotification: Build Failed
Error building Player: 9 errors

9203103–1283778–full_log.txt (31.5 KB)

Just for the record I found the solution for this.

GameCI images are base in a windows image that does not have the Windows Audios Service. I can not confirm that this might be the reason FMOD throws errors but by using Microsoft Artifact Registry as my base image the issue went away.