SERVER_PROCESS_PROCESS_EXIT_TIMEOUT when ending process

Hello,

When I make a ProcessEnding() call I am receiving the the following error. SERVER_PROCESS_PROCESS_EXIT_TIMEOUT

This is my code for ProcessEnding()

var gracefulShutdown = GameLiftServerAPI.ProcessEnding();
if (gracefulShutdown.Success)
{
   <code> 
}

I am receiving timeout errors from our test tool, and I assume it is because no response is being given when the error occurs. Do I need to be waiting for a response from ProcessEnding()? Any suggestions?

Adding Environment.Exit(0); based on GameLift Server API (C#) reference: Actions - Amazon GameLift

Hi @ChantzWB

Yes, you should wait for a successful response from ProceeEnding, then shutdown the process with a successful error code

See: GameLift Server API (C#) reference: Actions - Amazon GameLift

var processEndingOutcome = GameLiftServerAPI.ProcessEnding();
if (processReadyOutcome.Success)
   Environment.Exit(0);
// otherwise, exit with error code
Environment.Exit(errorCode);

I think your code is correct, are you still seeing the SERVER_PROCESS_PROCESS_EXIT_TIMEOUT events after adding Environment.Exit(0)?

Also, if you are using Unity, you should use Application.Quit(), if you are using Unreal, it might be FGenericPlatformMisc.RequestExit, see: SERVER_PROCESS_FORCE_TERMINATED event when manually scaling down fleet capacity - #4 by JamesM_Aws

@JamesM_Aws
I have actually created a simple HTTP server with C# to help test our online integration at WB Games. So I am trying to call ‘ProcessEnding()’ and return a response that this was successful. Sometimes the server doesn’t send a response (times out on my end), and sometimes it does. I was assuming it was because the ProcessEnding response wasn’t occurring immediately.

                    var gracefulShutdown = GameLiftServerAPI.ProcessEnding();
                    if (gracefulShutdown.Success)
                    {
                        Globals.status = "Terminated";
                        Message message = new Message
                        {
                            msg = "Terminating game server.",
                            error = null
                        };
                        string data = JsonConvert.SerializeObject(message);
                        return new Response("200", "application/json", data);
                    }

Here, no matter where I place Environment.Exit(0); my response won’t be delivered I assume. Without it, I was getting the SERVER_PROCESS_PROCESS_EXIT_TIMEOUT

Not sure if this is an odd workflow for you, but if you have any suggestions I appreciate it!

It is odd because this error occurs about 75% of the time, but is successful about 25%.

Oh man, inconsistent failures are the worst :confused:

Have you tested using GameLift Local? Testing Your Integration - Amazon GameLift

It will definitely speed up your testing since you are essentially communicating with GameLift onbox daemon via localhost. This can hopefully rule out some points of failure for you.

I was assuming it was because the ProcessEnding response wasn’t occurring immediately.

ProcessEnding is a blocking call, so you always receive a resolved response, i.e. process unregistered from the onbox daemon successfully or unsuccessfully.

Yeah everything seems to be working locally.

Hey @JamesM_Aws I was able to narrow down the issue. When I make a request with our CLI tool, the request sends a body parameter by default '{}'. When I removed this default body, the request to ‘ProcessEnding()’ works 100% of the time.

I also used HTTPie to test this. When I send a body - the request hangs, but when I don’t - the request is successful.

Is this because I don’t have my GameLift server configured correctly? Or is it because GameLift doesn’t know what to do with this data? I don’t have many answers, I can only say what is working for me.

I can work around this, but curious as to what is going on here.

Thanks
Chantz

Hi Chantz,

Are you strictly referring to testing with the GameLiftLocal tool? Or are you saying that you are able to send ProcessEnding() requests with a body via the SDK?

Also, which flavor of the SDK are you using? C# or C++? Are you using the latest versions? i.e. 4.0.2 for C# and 3.4.2 for C++?

Or is it because GameLift doesn’t know what to do with this data?

GameLift doesn’t take any data in ProcessEnding. You can see this via our doc or via the protobuf definition (unofficial):