Crash when packaging a project containing NiagaraAudioSpectrum in UE5.0.1

When I package a project including NiagaraAudioSpectrum and then launch the exe, it crashes.

We have confirmed that it can be reproduced by creating a new project and then following these steps
Create a NiagaraSystem containing NiagaraAudioSpectrum, place it in a level and package it, then launch the exe.
The packaging setup did not change the results no matter which one I tried, from Debug to Shipping.

Also, it can be launched in PIE or standalone without any problems.

Below is part of the log of the crash.

[2022.05.09-02.25.17:821][  0]LogWindows: Could not start crash report client using ../../../Engine/Binaries/Win64/CrashReportClient-Win64-Debug.exe
[2022.05.09-02.25.17:821][  0]LogMemory: Platform Memory Stats for Windows
[2022.05.09-02.25.17:821][  0]LogMemory: Process Physical Memory: 404.27 MB used, 409.68 MB peak
[2022.05.09-02.25.17:821][  0]LogMemory: Process Virtual Memory: 619.62 MB used, 620.30 MB peak
[2022.05.09-02.25.17:821][  0]LogMemory: Physical Memory: 13516.57 MB used,  18992.85 MB free, 32509.42 MB total
[2022.05.09-02.25.17:821][  0]LogMemory: Virtual Memory: 20359.93 MB used,  147668.41 MB free, 168028.33 MB total
[2022.05.09-02.25.17:821][  0]Message dialog closed, result: Ok, title: The UE5-MyProject2 Game has crashed and will close, text: Assertion failed: IsInGameThread() [File:D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\AudioThread.cpp] [Line: 663] 




[2022.05.09-02.25.17:821][  0]LogThreadingWindows: Error: Runnable thread FAsyncLoadingThread crashed.
[2022.05.09-02.25.17:821][  0]LogWindows: Error: === Critical error: ===
[2022.05.09-02.25.17:821][  0]LogWindows: Error: 
[2022.05.09-02.25.17:821][  0]LogWindows: Error: Assertion failed: IsInGameThread() [File:D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\AudioThread.cpp] [Line: 663] 
[2022.05.09-02.25.17:821][  0]LogWindows: Error: 
[2022.05.09-02.25.17:821][  0]LogWindows: Error: 
[2022.05.09-02.25.17:821][  0]LogWindows: Error: 
[2022.05.09-02.25.17:821][  0]LogWindows: Error: [Callstack] 0x00007ff759b00e17 UnrealGame.exe!FAudioCommandFence::BeginFence() []
[2022.05.09-02.25.17:821][  0]LogWindows: Error: [Callstack] 0x00007ff75429cbc2 UnrealGame.exe!FNiagaraSubmixListener::RegisterToSubmix() []
[2022.05.09-02.25.17:821][  0]LogWindows: Error: [Callstack] 0x00007ff75423a1e2 UnrealGame.exe!FNiagaraDataInterfaceProxySubmix::AddSubmixListener() []
[2022.05.09-02.25.17:821][  0]LogWindows: Error: [Callstack] 0x00007ff759b18fea UnrealGame.exe!FAudioDeviceManager::IterateOverAllDevices() []
[2022.05.09-02.25.17:821][  0]LogWindows: Error: [Callstack] 0x00007ff7542922f8 UnrealGame.exe!FNiagaraDataInterfaceProxySubmix::OnUpdateSubmix() []
[2022.05.09-02.25.17:821][  0]LogWindows: Error: [Callstack] 0x00007ff7542978af UnrealGame.exe!UNiagaraDataInterfaceAudioSpectrum::PostInitProperties() []
[2022.05.09-02.25.17:821][  0]LogWindows: Error: [Callstack] 0x00007ff755836cfc UnrealGame.exe!FObjectInitializer::PostConstructInit() []
[2022.05.09-02.25.17:821][  0]LogWindows: Error: [Callstack] 0x00007ff7558081e4 UnrealGame.exe!FObjectInitializer::~FObjectInitializer() []
[2022.05.09-02.25.17:821][  0]LogWindows: Error: [Callstack] 0x00007ff75584d3a3 UnrealGame.exe!StaticConstructObject_Internal() []
[2022.05.09-02.25.17:821][  0]LogWindows: Error: [Callstack] 0x00007ff75552541b UnrealGame.exe!FAsyncPackage2::EventDrivenCreateExport() []
[2022.05.09-02.25.17:821][  0]LogWindows: Error: [Callstack] 0x00007ff755530b27 UnrealGame.exe!FAsyncPackage2::Event_ProcessExportBundle() []
[2022.05.09-02.25.17:821][  0]LogWindows: Error: [Callstack] 0x00007ff755534c83 UnrealGame.exe!FEventLoadNode2::Execute() []
[2022.05.09-02.25.17:821][  0]LogWindows: Error: [Callstack] 0x00007ff75554e986 UnrealGame.exe!FAsyncLoadEventQueue2::PopAndExecute() []
[2022.05.09-02.25.17:821][  0]LogWindows: Error: [Callstack] 0x00007ff75556dc44 UnrealGame.exe!FAsyncLoadingThread2::Run() []
[2022.05.09-02.25.17:821][  0]LogWindows: Error: [Callstack] 0x00007ff755449e4b UnrealGame.exe!FRunnableThreadWin::Run() []
[2022.05.09-02.25.17:821][  0]LogWindows: Error: [Callstack] 0x00007ff755442d50 UnrealGame.exe!FRunnableThreadWin::GuardedRun() []
[2022.05.09-02.25.17:821][  0]LogWindows: Error: [Callstack] 0x00007fff73a954e0 KERNEL32.DLL!UnknownFunction []
[2022.05.09-02.25.17:821][  0]LogWindows: Error: [Callstack] 0x00007fff750c485b ntdll.dll!UnknownFunction []
[2022.05.09-02.25.17:821][  0]LogWindows: Error: 
[2022.05.09-02.25.17:821][  0]LogWindows: Error: Crash in runnable thread FAsyncLoadingThread
[2022.05.09-02.25.17:839][  0]LogExit: Executing StaticShutdownAfterError
[2022.05.09-02.25.17:839][  0]LogWindows: FPlatformMisc::RequestExit(1)
[2022.05.09-02.25.17:839][  0]LogWindows: FPlatformMisc::RequestExitWithStatus(1, 3)
[2022.05.09-02.25.17:839][  0]LogCore: Engine exit requested (reason: Win RequestExit)
[2022.05.09-02.25.17:848][  0]Log file closed, 05/09/22 11:25:17

You can see the same phenomenon from this product question

Reported as a bug in the engine

The problem is the async loading. When the NiagaraDataInterfaceAudioSpectrum loads async, it checks to see if it’s on the main game thread when RegisterToSubmix.

One fix is to disable Async Loading Thread in project settings

OR

Go into Engine\Source\Runtime\Engine\Private\AudioThread.cpp and comment out all
check(IsInGameThread());

Since the audio thread runs in it’s own thread and the source file is called AudioThread.cpp not sure why there is a check to make sure it’s on the main game thread. This check is ignored by the editor.

I’ve tested both. And since I want async loading, I went with option 2…
//check(IsInGameThread());

This is still happening in 5.0.3 (github 5.0 branch latest)… the Bug is flagged not to look at until 5.1

2 Likes

That works, thanks !

Now flagged for 5.2 :frowning:
Upvote at Unreal Engine Issues and Bug Tracker (UE-152571)

Issues site lists it as Fixed in 5.3