Server process exited without calling ProcessEnding()

I got that message from Fleet Events, should I call ProcessEnding() function when terminate game session?

Hi @nicky.zhang,

From my understanding, I believe what your server is doing is to first call TerminateGameSession and then exiting. Below, I’ll propose a different way to go about doing this.

There is two ways to tell GameLift that a Game Session has ended (and hence tell GameLift to stop sending players its way)

1- Call TerminateGameSession(). This will put the Game Session into the TERMINATED state but will also allow GameLift to send a fresh Game Session on this server process. This might not be the desired behavior you want.

2- I instead always recommend that the server call ProcessEnding. This will also put the Game Session into TERMINATED state but will also prevent more Game Sessions to be sent its way.

Once ProcessEnding is successfully invoked, the server can safely Exit (without triggering the event you mentionned). GameLift will make sure this spin up a fresh one ready to receive a fresh Game Session.

This has the advantage of recycling the runtime of the server process and avoid any kinds of weird memory leaks that might have sneaked in.

I hope this helps!


I’m getting the same error using UE4 4.19. I used the AWS provided server code. It looks like ProcessEnding() code is right there, bound to OnTerminate. I even breakpointed it, and that is being executed during server loadup.

Not sure why I’m getting this error event though. Any ideas?

	// Fill out your copyright notice in the Description page of Project Settings.
#include "KriegGameModeBase.h"
#include "Engine.h"
#include "EngineGlobals.h"
#include "GameLiftServerSDK.h"
#include "IPluginManager.h"
#include "ModuleManager.h"
AKriegGameModeBase::AKriegGameModeBase() : Super()
UE_LOG(LogTemp, Warning, TEXT("HELLO WORLD!!!"));
//Let's run this code only if GAMELIFT is enabled. Only with Server targets!
//Getting the module first.
FGameLiftServerSDKModule* gameLiftSdkModule = &FModuleManager::LoadModuleChecked<FGameLiftServerSDKModule>(FName("GameLiftServerSDK"));
//InitSDK establishes a local connection with GameLift's agent to enable further communication.
//When a game session is created, GameLift sends an activation request to the game server and passes along the game session object containing game properties and other settings.
//Here is where a game server should take action based on the game session object.
//Once the game server is ready to receive incoming player connections, it should invoke GameLiftServerAPI.ActivateGameSession()
auto onGameSession = [=](Aws::GameLift::Server::Model::GameSession gameSession)
FProcessParameters* params = new FProcessParameters();
//OnProcessTerminate callback. GameLift invokes this callback before shutting down an instance hosting this game server.
//It gives this game server a chance to save its state, communicate with services, etc., before being shut down.
//In this case, we simply tell GameLift we are indeed going to shut down.
params->OnTerminate.BindLambda([=]() {gameLiftSdkModule->ProcessEnding(); });
//This is the HealthCheck callback.
//GameLift invokes this callback every 60 seconds or so.
//Here, a game server might want to check the health of dependencies and such.
//Simply return true if healthy, false otherwise.
//The game server has 60 seconds to respond with its health status. GameLift defaults to 'false' if the game server doesn't respond in time.
//In this case, we're always healthy!
params->OnHealthCheck.BindLambda([]() {return true; });
//This game server tells GameLift that it listens on port 7777 for incoming player connections.
params->port = 7777;
//Here, the game server tells GameLift what set of files to upload when the game session ends.
//GameLift uploads everything specified here for the developers to fetch later.
TArray<FString> logfiles;
params->logParameters = logfiles;
//Calling ProcessReady tells GameLift this game server is ready to receive incoming game sessions!
UE_LOG(LogTemp, Warning, TEXT("IT WERKD"));
UE_LOG(LogTemp, Warning, TEXT("end"));