Server process exited without calling ProcessEnding(), exitCode(-1073740940)

So there are a good amount of posts regarding this issue but I believe I have implemented the shutdown process according to that advice and I am still getting the error. Also, the only post with this particular code appears to be rather old and related to the Lumberyard Engine itself (We are using UE4).

In my shutdown server process function, I am first calling TerminateGameSession, then checking that the outcome was successful, then calling ProcessEnding and again om a successful outcome then and only then do I call FGenericPlatformMisc::RequestExit(false); which tells Unreal to cleanly shutdown.

I am getting no obvious errors in the game log, it looks like it is shutting down cleanly.

I even inserted a 5-second sleep after both successful outcomes and still get the error.

Any help would be appreciated. Thanks!

I do the same thing you just described, so I believe that what you’re doing is fine, especially considering your game is shutting down cleanly. Here’s the code just to make sure we’re on the same page:

auto TerminateGameSessionOutcome = Aws::GameLift::Server::TerminateGameSession();
if (TerminateGameSessionOutcome.IsSuccess()) {
	auto ProcessEndingOutcome = Aws::GameLift::Server::ProcessEnding();
	if (ProcessEndingOutcome.IsSuccess())

This is a longshot, but what does your OnProcessTerminate Lambda function that you pass to Aws::GameLift::Server::ProcessParameters, which is passed to Aws::GameLift::Server::ProcessReady look like? Perhaps something in that function is causing that error message?

Hey @chrisgong, thanks for replying.

Yep we are on the same page, however, I was calling TerminateGameSession and ProcessEnding through the gameLiftSdkModule instance rather than statically like you are doing. I tried calling them statically though just to test and got the same error message.

As for the OnProcessTerminate function, I haven’t touched the bind from the standard code that aws advised when adding GameLift here

Hmmmm, in that case, are you able to test your game locally and check if the exit code is still -1073740940? Because usually if it was a clean shutdown, then the exit code would be 0.

1 Like

Unfortunately the connection logic is integrated with Flexmatch at this time, whose API is not exposed to gamelift local. So we have not be using gamelift local at all and might need to make some dev-only logic to work with it. Its a good idea though, might have to bite the bullet.

I’m also using a custom child class of FGameLiftServerSDKModule so maybe that is causing an issue. Switching back to the standard FGameLiftServerSDKModule to test it now.

1 Like

Ended up getting GameLift local working for at least the server (no client connections) and found that the server wasn’t exiting cleanly. One of the plugins was trying to free memory that had already been freed. Now resolved and I don’t get the error from GameLift anymore. Thanks @chrisgong for pointing me in the right direction!

1 Like