Unable to reserver a process on fleet ( FleetCapacityExceededException)

I have created a game fleet for my game. In Fleet Setting, i set concurrent process to 10.

Here is my game fleet status. I see that there are 4 active instances. But when client send request to create new game session, sometime i got this exception:

What’s the reason? I don’t see anything wrong with my fleet setting. Why no active and available server processes found on my fleet? How to fix that error?
Please help me beacuse my project gonna to launch into production.
Thank you very much!

Hi @hieudt ,

Getting FleetCapacityExceededException means that there are no game server processes running on your fleet that are available to host your gameSession. If you have enough capacity/hosts under your fleet then there is likely some issue with your server processes causing GameLift to think they are unhealthy and not available for a GameSession.

Steps to debugging further:

Maybe something misunderstand. Let me explain my game flow:
A client create a room, and wait for others to join to play together.
when client request to create a room by CreateGameSessionAsync method, gamelfit will start 1 game server instance (server build I uploaded ), and if successful, it will return to my client ip address and port of server instance, and client connect to that ip/port to join this room and play. If a game session successful created, it appear on “AvailableGameSessions” metric.
But this exception occur sometimes when client call CreateGameSessionAsync method, mean that can’t create a game session, or gamelift can’t start my game server instance, is that right? I think It’s not related to “AvailableGameSessions” in gamelift console.
In detail of the error, it said:
So I guess it’s something wrong with gamelift fleet?
I think i have intergrated correctly with Gamelift Server SDK, because this exception not occur all the time. Sometimes, i can create game session and join to play normally.

I took a quick look at logs and metrics for your fleet “fleet-e29fc720-afa4-4efb-9993-af4b2e6b49d0”, and found that your server processes are reporting unhealthy during healthCheck (OnHealthCheck method is returning false), and eventually being shut-down. Unhealthy server processes are not considered available for GameSession.

Example logs:

30 Nov 2021 08:36:44 Received health report from process: 2538, isHealthy: true
30 Nov 2021 08:37:44 Received health report from process: 2538, isHealthy: false
30 Nov 2021 08:38:44 Received health report from process: 2538, isHealthy: false
30 Nov 2021 08:39:44 Received health report from process: 2538, isHealthy: false
30 Nov 2021 08:39:53 Detected a process (pid: 2538) that has been unhealthy for more than 180 seconds. Terminating the process.

This can be fixed by determining why you are returning false in the OnHealthCheck callback, and switching it to return true.

In the future, you can debug this on your end by:

1 Like

That’s it, I know what’s the reason.
I was implemented that if no client connect to server after 30 seconds, set healthy to false, so it’ll auto shutdown if no client connects after long time.
But it was wrong, I should check it after game session start, because when server is idle, ofcourse no client connect, and if i set healthy to false, it can’t create game session after that :smiley:
Do you have any advice what should I implement in OnHealthCheck? or just simply return true ?
Thank you very much!

OnHealthCheck should return true if you want to be able to create a GameSession on that serverProcess.
Returning False will make it so that GameLift does not consider the serverProcess as available.

If there are any conditions during which you wouldn’t want a gameSession to be placed on a serverProcess (for example: maybe something went wrong with the serverProcess Initialization), then you should return false, but otherwise returning true is correct (so that the process can be used).

1 Like

Thank you very much for you help!