Cannot create concurrent game sessions on spot instances in GameLift fleet

0

I'm working on getting a GameLift fleet up and running. I've been testing in GameLift Local for a while now and just recently started using GameLift proper to test the server build. I have it set to be able to handle 10 concurrent processes per instance (with ten ports specified for use), and I only have one instance running. I can connect to the instance just fine with one client, but I cannot connect with additional clients, even though I set it to allow up to ten. Checking the GameSessions tab for the Fleet in the GameLift console, I can see that only one GameSession is ever active at a time.

I'm also seeing a bunch of SERVER_PROCESS_CRASHED events in the event tab that say "Server process exited without calling ProcessEnding(), exitCode(0)," and these are happening between every 5 to 10 minutes.

I'm assuming the two issues are connected but I'm not sure how to fix it. I've looked for solutions but I haven't found anything that works yet. The game server is built in Unity, and there's a couple of parts of the code that I'm curious might be the issue, even though I never saw any such errors in GameLift local.

First, I wonder if I'm calling Application.Quit() to quickly after calling ProcessEnding(). Right now I have them running like this:

        var result = GameLiftServerAPI.ProcessEnding();
        _networkManager.ServerManager.StopConnection(true);
        Application.Quit();

Based on some other posts I've seen, it sounds like I need to wait until the ProcessEnding() result is true, but shouldn't it already wait to get the result in this context before calling Application.Quit()?

Second, I thought it's possible that my method for setting the port might be causing an issue. I had seen a post that said it wasn't working on Linux at one point, but I tested it on a regular Linux EC2 instance in a dummy project with multiple processes running, and they were able to increment through the array of ports I set looking for unused ports. That code is like this:

    private void SelectAvailablePort()
    {
        foreach (var port in ports)
        {
            bool available = false;

            available = IsListeningPortAvailable(port);
            
            if (available)
            {
                sessionPort = port;
                break;
            }
        }
    }

    public bool IsListeningPortAvailable(int port) =>
        !IPGlobalProperties.GetIPGlobalProperties().GetActiveUdpListeners().Any(x => x.Port == port);

I'm not sure if this is breaking something on the server, since I was able to get it to work fine in the dummy project on a Linux instance, but since I cannot get past the single GameSession and I remember seeing someone saying it didn't work on Linux, it makes me wonder if it could be the issue.

Do you see anything in the code above that could be causing the issue, or if not, is there something else I should try checking to see if it's the source of the problem. Again, I'm just trying to get the game to allow for multiple GameSessions per instance, but only one server process is active at a time. When I try to connect from a second client, I get an error that says there weren't any server processes available. Any advice you may have would be greatly appreciated!

Josh
asked 2 months ago29 views
1 Answer
0

Hi,

To answer your first question, ProcessEnding is a synchronous call, so you don't have to wait. You should however confirm that the result is successful.

I can't find anything wrong with the port search.

To answer your primary concern about not being able to run multiple concurrent processes, there are two things you could check.

  1. In your fleet's RuntimeConfiguration, make sure that MaxConcurrentGameSessionActivations can handle the number of concurrent game sessions you want to spin up at once, since that limits the number of game sessions in status ACTIVATING at once.
  2. In your fleet's RuntimeConfiguration's ServerProcesses, make sure ConcurrentExecutions can handle the number of game sessions you are trying to run concurrently.

Here are some documents that may point you in the right direction: https://docs.aws.amazon.com/gamelift/latest/apireference/API_RuntimeConfiguration.html https://docs.aws.amazon.com/gamelift/latest/developerguide/fleets-multiprocess.html

answered 19 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions