Multiple errors running Unreal Engine plugin in Docker containers

We’re trying to set up FMOD for our Unreal Engine based game in Docker containers, however experiencing issues during FMOD initialization.

You can obtain docs for Unreal Engine containers (well, at least instructions on how to build them) here: Containers Quick Start | Unreal Engine Documentation

First, Windows. This is the most problematic one. This is what logged during attempt to cook project:

LogInit: Display: LogFMOD: Error: c:\jk\workspace\Build__2.2__Unreal_Win\core_api\platforms\win\src\fmod_os_misc.cpp(87) - COM not initialized on this thread, call CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED) to avoid this.
LogFMOD: Error: c:\jk\workspace\Build__2.2__Unreal_Win\core_api\platforms\win\src\fmod_os_misc.cpp(101) - IMMDeviceEnumerator::RegisterEndpointNotificationCallback returned 0x80070424.
LogFMOD: Error: 'FMOD::Studio::System::create(&StudioSystem)' returned 'Error initializing output device.'
LogFMOD: Error: 'StudioSystem->getCoreSystem(&lowLevelSystem)' returned 'An invalid object handle was used.'
LogFMOD: Error: 'lowLevelSystem->setOutput(FMOD_OUTPUTTYPE_NOSOUND_NRT)' returned 'An invalid object handle was used.'
LogFMOD: Error: 'StudioSystem->initialize(1, FMOD_STUDIO_INIT_ALLOW_MISSING_PLUGINS | FMOD_STUDIO_INIT_SYNCHRONOUS_UPDATE, FMOD_INIT_MIX_FROM_UPDATE, nullptr)' returned 'An invalid object handle was used.'

I believe that first error message (about CoInitializeEx) is a 100% bug. I don’t see calls to CoInitialize/CoInitializeEx anywhere in FMOD plugin. There’s neither any guarantee that Unreal Engine itself will call it anywhere. However, your own documentation says that CoInitializeEx is required before calling any of FMOD functions: https://fmod.com/resources/documentation-api?version=2.00&page=platforms-win.html#com

WRT IMMDeviceEnumerator::RegisterEndpointNotificationCallback: 0x80070424 means that desktop experience is not installed on a Windows Server system. And this is true! We are trying to cook a game build, this is not a desktop system. I believe this can be reproduced outside of containers on a Windows Server Core system.

I’m not sure whether later errors are a concequence of IMMDeviceEnumerator::RegisterEndpointNotificationCallback one or are caused by something different. Note again that we do not actually plan to play any sounds, this happens just because FFMODAssetBuilder::Create is called from FFMODStudioEditorModule::OnPostEngineInit.

Now, to Linux. Here’s situation is much better:

LogFMOD: Error: ../../../core_api/platforms/linux/src/fmod_os_misc.cpp(458) - Cannot set real-time thread priorities due to insufficient privileges

This message is originally a warning, but then promoted to an error because we have a zero-warning policy for the cooking process. However, I want to argue that making it a warning is too much. User almost NEVER has permissions to raise priority of their processes. You even can’t set priority to realtime on Windows unless running under user with admin priviledges! So, I believe this call should either be completely excluded on Linux or message downgraded to something like “info or even debug”

CoInitialize/CoInitializeEx is called internally by FMOD during audio driver initialization; we have previously had users getting past the “Error initializing output device” error on Windows Server by starting the Windows Audio service. Can you please confirm that the Windows Audio service is running in your windows container?

You arguments for downgrading this warning seem reasonable to me, I will pass this along to the dev team for them to evaluate.

Also, can you please let me know which version of FMOD you are using? Just so I can pin down where these error messages are coming from.

CoInitialize/CoInitializeEx is called internally by FMOD during audio driver initialization

It looks like it happens too late. I’m no longer getting that CoInitialize error if calling CoInitialize this way: Initialize COM before making any calls to FMOD API by slonopotamus · Pull Request #68 · fmod/fmod-for-unreal · GitHub

Can you please confirm that the Windows Audio service is running in your windows container?

I’m not sure how I do that. Most likely the answer will be “Windows Audio is not installed on Windows Server Core at all”.

which version of FMOD you are using?

2.02.03

WRT “Cannot set real-time thread priorities due to insufficient privileges” on Linux. I’m actually seeing in when just running FMOD on Linux as normal user.

Okay that does indeed sound like a bug then, did that also resolve the other error messages?

You should just need to run the following line with admin priveleges in your Windows Server instance:

net start "Windows Audio"

If it says it failed, or already running, or that it isn’t installed, can you please tell me what version of Windows Server you are running?

Thank you for the extra info, I have reproduced this in Linux as described, that should make it a bit easier for the developers to reproduce the issue.