Packaged: Assertion Failed: IsInGameThread

Hi there,

We’ve recently upgraded to 4.19, and we’ve stumbled upon the crash described below.

When does it happen?

The game opens up the Main Menu map fine, which contains a small 3D environment with an animation sequence and a basic UI interface for new game and such.

Then, when clicking on New Game, the game is supposed to simply load the starting level, but we receive the following error:

240262-uobject-isingamethread-crash.png

Code

Basically, the following function returns false, causing the game to crash, if this is of any help:

FORCEINLINE bool IsInGameThread()
{
	if(GIsGameThreadIdInitialized)
	{
		const uint32 CurrentThreadId = FPlatformTLS::GetCurrentThreadId();
		return CurrentThreadId == GGameThreadId;
	}

	return true;
}

Does anyone have any insight as to where to begin to debug this crash?

Any help would be hugely appreciated.

EDIT: The project is blueprint-only with the exception of two minor C++ class that aren’t called on level loading. One if for taking screenshot on game save, the other one of for changing culture for localization.

UE4 has design around assertion, it a concept that assums that it is better to crash program when you things aren’t way you expected rether then let it randomly crash which is a lot harder to debug. You can read more about it here:

So in UE4 you state that you expect to be or expect to cause cause instability before executing specific sequence of code by placing check() function with bool statement (same as you use if ifs), if it’s false it will crash engine and put failed statement in log. In your case is just IsInGameThread() function which return false if code is not running on game thread, which means you or engine code called a function which not suppose to run anywhere else then game thread, the usally culprit is rendering thread, you can also get asset crash of something that not suppose to run on game thread or only in render thread.

So best way to debug assertion failed is to simply look on call stack which is effectively list of sequence of functions which cause crash, search if your code is not in there and if there try to move the code to function which will be called by game thread or avoid calling function that cause crash, sometimes there special version of function for render thread so try to search for that. If it’s not and it’s engine code then it’s most likely a bug, cause even if it’s cause of your doing without C++ it should not crash from assertion. If you can reproduce it then bug raport

1 Like

Problem is, our project is pretty much blueprint-only with two minor C++ class, that are not called on level loading, so what am I supposed to look at here?

Also, how can I get the call stack on a packaged project? We can look at the crash log, but it’s not giving much relevant info. It doesn’t crash if it’s not packaged.

Disabling Async Loading fixed the problem. We’re gonna go with that for now.

1 Like

I suppose you fixed it already but for the record I was having the same error after an asynchronous call back with the result of showing a rewarded video on Android. No matter what was the next node, there was an error thread error. Just a simple delay solved the problem

1 Like

Hi
Facing similar error when trying to open the packages project. It shows unable to load a blueprint class. Kindly help. How to disable the async loading? Where should this be performed?

1 Like

Just had a similar issue after the engine tried to compile an async task involving a static mesh compiler. To clarify the error was an engine error and not due to my cpp code. After i reported and closed the engine, on the next start and compile it worked successfully. I am using engine 5.1