random "Pure virtual function being called" crash in packaged build when loading a level

No idea what’s causing this to happen when loading into another level. I haven’t touched any code in the project, everything is done by blueprints. The crash only happens in packaged build of the game, not in editor and is inconsistent. Sometimes the level loads just fine, sometimes it crashes. I have been trying to look around but all the solutions seem to be c++ stuff. The game is a single player game.

Level loading is done by Open Level by name. Crash happens entering and exiting empty levels aswell.

[2023.06.16-18.47.48:088][ 33]LogThreadingWindows: Error: Runnable thread Foreground Worker #1 crashed.
[2023.06.16-18.47.48:088][ 33]LogWindows: Error: === Critical error: ===
[2023.06.16-18.47.48:088][ 33]LogWindows: Error: 
[2023.06.16-18.47.48:088][ 33]LogWindows: Error: Fatal error: [File:D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Private\Windows\WindowsPlatformMisc.cpp] [Line: 441] 
[2023.06.16-18.47.48:088][ 33]LogWindows: Error: Pure virtual function being called
[2023.06.16-18.47.48:088][ 33]LogWindows: Error: 
[2023.06.16-18.47.48:088][ 33]LogWindows: Error: 
[2023.06.16-18.47.48:088][ 33]LogWindows: Error: [Callstack] 0x00007ffda81d6ea4 VCRUNTIME140.dll!UnknownFunction []
[2023.06.16-18.47.48:088][ 33]LogWindows: Error: [Callstack] 0x00007ff6c59dde80 Project-Win64-DebugGame.exe!UE::Shader::FPreshaderData::EvaluateConstant() []
[2023.06.16-18.47.48:088][ 33]LogWindows: Error: [Callstack] 0x00007ff6c59de261 Project-Win64-DebugGame.exe!UE::Shader::EvaluatePreshader() []
[2023.06.16-18.47.48:088][ 33]LogWindows: Error: [Callstack] 0x00007ff6c545131b Project-Win64-DebugGame.exe!FUniformExpressionSet::FillUniformBuffer() []
[2023.06.16-18.47.48:088][ 33]LogWindows: Error: [Callstack] 0x00007ff6c53b0ef2 Project-Win64-DebugGame.exe!<lambda_24175183c3d77fddc597a772f63b6989>::operator()() []
[2023.06.16-18.47.48:088][ 33]LogWindows: Error: [Callstack] 0x00007ff6be5414ea Project-Win64-DebugGame.exe!TGraphTask<TFunctionGraphTaskImpl<void __cdecl(void),0> >::ExecuteTask() []
[2023.06.16-18.47.48:088][ 33]LogWindows: Error: [Callstack] 0x00007ff6bfdef808 Project-Win64-DebugGame.exe!<lambda_17c904c32264d0348d15245fba0e1bff>::operator()() []
[2023.06.16-18.47.48:088][ 33]LogWindows: Error: [Callstack] 0x00007ff6bfdf8f83 Project-Win64-DebugGame.exe!LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask * __ptr64 __cdecl(bool),48>::TTaskDelegateImpl<<lambda_17c904c32264d0348d15245fba0e1bff>,0>::CallAndMove() []
[2023.06.16-18.47.48:088][ 33]LogWindows: Error: [Callstack] 0x00007ff6bfe083de Project-Win64-DebugGame.exe!LowLevelTasks::FTask::ExecuteTask() []
[2023.06.16-18.47.48:088][ 33]LogWindows: Error: [Callstack] 0x00007ff6bfe08157 Project-Win64-DebugGame.exe!LowLevelTasks::FScheduler::ExecuteTask() []
[2023.06.16-18.47.48:088][ 33]LogWindows: Error: [Callstack] 0x00007ff6bfde9185 Project-Win64-DebugGame.exe!LowLevelTasks::FScheduler::TryExecuteTaskFrom<LowLevelTasks::TLocalQueueRegistry<1024>::TLocalQueue,&LowLevelTasks::TLocalQueueRegistry<1024>::TLocalQueue::DequeueGlobal,0>() []
[2023.06.16-18.47.48:088][ 33]LogWindows: Error: [Callstack] 0x00007ff6bfe37e32 Project-Win64-DebugGame.exe!LowLevelTasks::FScheduler::WorkerMain() []
[2023.06.16-18.47.48:088][ 33]LogWindows: Error: [Callstack] 0x00007ff6bfdf7cd0 Project-Win64-DebugGame.exe!UE::Core::Private::Function::TFunctionRefCaller<<lambda_3277f5600efe2aa6f5f67d459ec105a9>,unsigned __int64 __cdecl(unsigned __int64)>::Call() []
[2023.06.16-18.47.48:088][ 33]LogWindows: Error: [Callstack] 0x00007ff6bff6757e Project-Win64-DebugGame.exe!FThreadImpl::Run() []
[2023.06.16-18.47.48:088][ 33]LogWindows: Error: [Callstack] 0x00007ff6c0469a42 Project-Win64-DebugGame.exe!FRunnableThreadWin::Run() []
[2023.06.16-18.47.48:088][ 33]LogWindows: Error: [Callstack] 0x00007ff6c045fb10 Project-Win64-DebugGame.exe!FRunnableThreadWin::GuardedRun() []
[2023.06.16-18.47.48:088][ 33]LogWindows: Error: [Callstack] 0x00007ffdb48055a0 KERNEL32.DLL!UnknownFunction []
[2023.06.16-18.47.48:088][ 33]LogWindows: Error: [Callstack] 0x00007ffdb49e485b ntdll.dll!UnknownFunction []
[2023.06.16-18.47.48:088][ 33]LogWindows: Error: 
[2023.06.16-18.47.48:088][ 33]LogWindows: Error: Crash in runnable thread Foreground Worker #1
[2023.06.16-18.47.48:099][ 33]LogExit: Executing StaticShutdownAfterError
[2023.06.16-18.47.48:100][ 33]LogWindows: FPlatformMisc::RequestExit(1)
[2023.06.16-18.47.48:100][ 33]LogWindows: FPlatformMisc::RequestExitWithStatus(1, 3)
[2023.06.16-18.47.48:100][ 33]LogCore: Engine exit requested (reason: Win RequestExit)

Do you have a task with the wrong signature?

Do you have a reference to a pointer inside the task?

I haven’t touched any of the code, all I’ve done is work with the blueprints. I don’t know what that means.

Windows\WindowsPlatformMisc.cpp

Ok, maybe you have a variable or function with the same name that uses a windows library in a task… that happened to me once… it’s a horrible conflict that Epic should solve…

Try changing the name of your variables and functions, maybe that works.

I’ll give that a shot, thanks!

Thankfully the project is at it’s early stages and the blueprints are still pretty simple. I went through all the variables and functions as you suggested, renamed anything that could be even remotely close to something that might exist already but I’m still having the same crash.

According to the log files, the level loads fine, after that there’s always the same “Pure virtual function being called” and nothing relevant after that

Do you have any plugin installed?
or something downloaded from the epic store?

It seems to be a very common problem… there are a lot of people who solved this problem in different ways.

Look at the ones with the green V… maybe one will work for you

https://forums.unrealengine.com/search?expanded=true&q=WindowsPlatformMisc.cpp

I have looked around to see if anyone has anything even remotely close to my problem but doesn’t seem like it. At the moment for some reason completely wiping the foliage might seem to fix the issue

Did you download the foliage from the internet?

You have to be careful what you download from the internet.

Epic is continually updating everything.

What works in version 5.1 in version 5.2 may be broken.

Compatibility is not Epic’s forte.

And it’s a headache for programmers.

False alarm, still crashes without any foliage. Crash is just random and sometimes doesn’t happen. Project was started in 5.2 and only 5.2 has been used.

All meshes and assets are made and there’s nothing complicated in the project. Everything works just fine in the editor.

Package smaller versions of the game and then move on from there to include more content in the packaged build to narrow down what is causing the problem.

I’m doing exactly that.

Removing foliage seems to make the crash less frequent but still happens.

tray to debug you code:

The crash is not present in the editor, everything works as intended.
Attaching Visual Studio to the packaged executable gives me:

Call Stack:

>	Project-Win64-DebugGame.exe!UE::Logging::Private::BasicFatalLog(struct FLogCategoryBase const &,struct UE::Logging::Private::FStaticBasicLogRecord const *,...)	C++
 	vcruntime140.dll!00007ffda81d6ea4()	Unknown
 	Project-Win64-DebugGame.exe!UE::Shader::FPreshaderData::EvaluateConstant(class FMaterial const &,class UE::Shader::FPreshaderStack &)	C++
 	Project-Win64-DebugGame.exe!UE::Shader::EvaluatePreshader(class FUniformExpressionSet const *,struct FMaterialRenderContext const &,class UE::Shader::FPreshaderStack &,struct UE::Shader::FPreshaderDataContext &)	C++
 	Project-Win64-DebugGame.exe!FUniformExpressionSet::FillUniformBuffer(struct FMaterialRenderContext const &,class TArrayView<class IAllocatedVirtualTexture * const,int>,struct FRHIUniformBufferLayout const *,unsigned char *,int)	C++
 	Project-Win64-DebugGame.exe!<lambda_24175183c3d77fddc597a772f63b6989>::operator()(void)	C++
 	Project-Win64-DebugGame.exe!TGraphTask<class TFunctionGraphTaskImpl<void ,0> >::ExecuteTask(class TArray<class FBaseGraphTask *,class TSizedDefaultAllocator<32> > &,enum ENamedThreads::Type,bool)	C++
 	Project-Win64-DebugGame.exe!<lambda_17c904c32264d0348d15245fba0e1bff>::operator()(bool)	C++
 	Project-Win64-DebugGame.exe!LowLevelTasks::TTaskDelegate<class LowLevelTasks::FTask * ,48>::TTaskDelegateImpl<class <lambda_17c904c32264d0348d15245fba0e1bff>,0>::CallAndMove(class LowLevelTasks::TTaskDelegate<class LowLevelTasks::FTask * ,48> &,void *,unsigned int,bool)	C++
 	Project-Win64-DebugGame.exe!LowLevelTasks::FTask::ExecuteTask(void)	C++
 	Project-Win64-DebugGame.exe!LowLevelTasks::FScheduler::ExecuteTask(class LowLevelTasks::FTask * &)	C++
 	Project-Win64-DebugGame.exe!LowLevelTasks::FScheduler::TryExecuteTaskFrom<class LowLevelTasks::TLocalQueueRegistry<1024>::TLocalQueue,&LowLevelTasks::TLocalQueueRegistry<1024>::TLocalQueue::DequeueGlobal(bool,bool),0>(class LowLevelTasks::TLocalQueueRegistry<1024>::TLocalQueue *,class LowLevelTasks::TLocalQueueRegistry<1024>::FOutOfWork &,bool,bool)	C++
 	Project-Win64-DebugGame.exe!LowLevelTasks::FScheduler::WorkerMain(struct LowLevelTasks::FSleepEvent *,class LowLevelTasks::TLocalQueueRegistry<1024>::TLocalQueue *,unsigned int,bool)	C++
 	Project-Win64-DebugGame.exe!UE::Core::Private::Function::TFunctionRefCaller<class <lambda_3277f5600efe2aa6f5f67d459ec105a9>,unsigned __int64 >::Call(void *,unsigned __int64 &)	C++
 	Project-Win64-DebugGame.exe!FThreadImpl::Run(void)	C++
 	Project-Win64-DebugGame.exe!FRunnableThreadWin::Run(void)	C++
 	Project-Win64-DebugGame.exe!FRunnableThreadWin::GuardedRun(void)	C++
 	kernel32.dll!00007ffdb48055a0()	Unknown
 	ntdll.dll!00007ffdb49e485b()	Unknown

and

Output:

[2023.06.17-16.08.59:861][609]LogWorld: Bringing World /Game/DEBUG_3.DEBUG_3 up for play (max tick rate 0) at 2023.06.17-19.08.59
[2023.06.17-16.08.59:862][609]LogWorld: Bringing up level for play took: 0.023394
[2023.06.17-16.08.59:865][609]LogLoad: Took 0.143870 seconds to LoadMap(/Game/DEBUG_3)
[2023.06.17-16.08.59:920][611]LogRHI: Display: Encountered a new graphics PSO: 4147800097
[2023.06.17-16.08.59:920][611]LogRHI: Display: Encountered a new graphics PSO: 2340842033
[2023.06.17-16.08.59:920][611]LogRHI: Display: Encountered a new graphics PSO: 924197942
[2023.06.17-16.08.59:921][611]LogRHI: Display: Encountered a new graphics PSO: 1576252887
[2023.06.17-16.08.59:921][611]LogRHI: Display: Encountered a new graphics PSO: 932699947
[2023.06.17-16.08.59:922][611]LogRHI: Display: Encountered a new compute PSO: 3984833839
[2023.06.17-16.08.59:922][611]LogRHI: Display: Encountered a new graphics PSO: 913897655
[2023.06.17-16.08.59:922][611]LogRHI: Display: Encountered a new compute PSO: 1457830336
[2023.06.17-16.08.59:923][611]LogRHI: Display: Encountered a new graphics PSO: 4049245355
[2023.06.17-16.08.59:923][611]LogRHI: Display: Encountered a new graphics PSO: 120230079
[2023.06.17-16.08.59:924][611]LogRHI: Display: Encountered a new graphics PSO: 1641589182
[2023.06.17-16.08.59:926][611]LogRHI: Display: Encountered a new graphics PSO: 445968875
[2023.06.17-16.08.59:926][611]LogRHI: Display: Encountered a new graphics PSO: 4066546391
[2023.06.17-16.08.59:926][611]LogRHI: Display: Encountered a new graphics PSO: 3603674760
[2023.06.17-16.08.59:927][611]LogRHI: Display: Encountered a new graphics PSO: 4275177059
[2023.06.17-16.08.59:928][611]LogRHI: Display: Encountered a new graphics PSO: 2697711503
[2023.06.17-16.08.59:930][611]LogRHI: Display: Encountered a new graphics PSO: 1864617830
[2023.06.17-16.08.59:931][611]LogRHI: Display: Encountered a new graphics PSO: 4212943507
[2023.06.17-16.08.59:931][611]LogRHI: Display: Encountered a new graphics PSO: 505293139
[2023.06.17-16.08.59:932][611]LogRHI: Display: Encountered a new graphics PSO: 2106081846
[2023.06.17-16.08.59:933][611]LogRHI: Display: Encountered a new graphics PSO: 1930006354
[2023.06.17-16.08.59:933][611]LogRHI: Display: Encountered a new graphics PSO: 4187165178
[2023.06.17-16.08.59:934][611]LogRHI: Display: Encountered a new graphics PSO: 1177132347
[2023.06.17-16.08.59:939][611]LogRHI: Display: Encountered a new graphics PSO: 826057856
[2023.06.17-16.08.59:939][611]LogRHI: Display: Encountered a new graphics PSO: 3128072576
[2023.06.17-16.08.59:939][611]LogRHI: Display: Encountered a new graphics PSO: 2194845194
[2023.06.17-16.08.59:940][611]LogRHI: Display: Encountered a new graphics PSO: 434630558
[2023.06.17-16.08.59:940][611]LogRHI: Display: Encountered a new graphics PSO: 313947292
[2023.06.17-16.08.59:941][611]LogRHI: Display: Encountered a new graphics PSO: 1700587133
[2023.06.17-16.08.59:942][611]LogRHI: Display: Encountered a new graphics PSO: 3173142694
[2023.06.17-16.08.59:942][611]LogRHI: Display: Encountered a new graphics PSO: 4014415773
[2023.06.17-16.08.59:943][611]LogRHI: Display: Encountered a new graphics PSO: 249826844
[2023.06.17-16.08.59:943][611]LogRHI: Display: Encountered a new graphics PSO: 1181680040
[2023.06.17-16.08.59:944][611]LogRHI: Display: Encountered a new graphics PSO: 1160007457
[2023.06.17-16.08.59:945][611]LogRHI: Display: Encountered a new graphics PSO: 1549145889
[2023.06.17-16.08.59:945][611]LogRHI: Display: Encountered a new graphics PSO: 1038749680
[2023.06.17-16.08.59:946][611]LogRHI: Display: Encountered a new graphics PSO: 3608617056
[2023.06.17-16.08.59:946][611]LogRHI: Display: Encountered a new graphics PSO: 2034906587
[2023.06.17-16.08.59:947][611]LogRHI: Display: Encountered a new graphics PSO: 1245869763
A breakpoint instruction (__debugbreak() statement or a similar call) was executed in Project-Win64-DebugGame.exe.

'Project-Win64-DebugGame.exe' (Win32): Loaded 'C:\Windows\System32\CoreMessaging.dll'. 
'Project-Win64-DebugGame.exe' (Win32): Loaded 'C:\Windows\System32\CoreUIComponents.dll'. 
Fatal error: [File:D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Private\Windows\WindowsPlatformMisc.cpp] [Line: 441] 
Pure virtual function being called
A breakpoint instruction (__debugbreak() statement or a similar call) was executed in Project-Win64-DebugGame.exe.

I don’t see anything here that would help the case

For some reason, it seems like the crash happens when there are multiple Actor Foliage being rendered at the spawn location in a map. I have no idea how this has anything to do with “pure functions” considering none of the Actor Foliages have any functions in them.

The fix isn’t optimal, but managed to workaround by making the foliage actors hidden in-game and setting this value back to false after half a second.

From what you say, it is possible that a DLL is missing in the packaged version or something like that (a dependency)

In the editor there is everything that the program needs, but in the packaged version something is missing.

I think so…

In the editor there is everything that the program needs, but in the packaged version something is missing.

I solved the issue by delaying foliage rendering by half a second so I don’t think that’s the case.

EDIT:

The crash made a short return. I had added some pieces of foliage that didn’t render on a delay like the rest, so something about having a lot of foliage spawning at the exact moment the level is loaded is causing it to crash.

Yes, look, Unreal works a lot with threads.

When loading very heavy assets sometimes the game starts and the instances are not ready to be used.

A delay can work (on your computer).

Unfortunately you don’t know how long someone else’s computer will take.

Better check the instance with a timer until it is valid.

If you find a better solution, please let me know. I am very interested in that too.

Thank you so much!!

Thank you for helping to investigate the problem! I actually already looked into this but seems like there’s no way to check wether everything in the level has finished loading using Open Level. I’ll let you know if I figure something out!

The assets themselves aren’t heavy at all; they’re trees made up of sprites.
If I had to guess, the issue has something to do with the material the trees use, they consist of couple of layered sprites. The material has a waving effect to it and it uses the coordinates of the tree itself to offset the effect so that two trees don’t move exactly the same way.

The crash returned previously as soon as bushes using the same material were added to the map, since they didn’t have the delay.

1 Like