question

Juris Zebnickis avatar image
Juris Zebnickis asked

Server does not transition to Terminating after successful shutdown request

I am hosting a UE4 dedicated game server linux build and can't get it to 'deactivate'.

I understand from reading the docs and relevant posts that I have to either include logic in the server code that manages graceful shutdown or I can use the API call from anywhere else. So, I added to the MpsAllocator from the samples to handle a shutdown request like so:

static async Task ShutdownServer()
        {
            var req = new PlayFab.MultiplayerModels.ShutdownMultiplayerServerRequest();
            req.BuildId = ReadBuildIDFromInput();
            var regions = await GetRegions(req.BuildId);
            string region = ReadRegionFromInput(regions);
            req.SessionId = Guid.NewGuid().ToString();
            req.Region = region;


            var res = await PlayFabMultiplayerAPI.ShutdownMultiplayerServerAsync(req);
            if (res.Error != null)
            {
                Console.WriteLine(res.Error.ErrorMessage);
            }
            else
            {
                PrettyPrintJson(res.Result);
            }
        }

This seems to execute without errors and my project dashboard also shows a successful execution of the call, however, the server always stays 'Active'. From my understanding, as long as it stays in this state, it will consume the VM hours.

The only way to shut it down so far seems to be removing it entirely from the region list, but this takes time, changes its' address and just does not seem right to me.

Is this working as intended or am I missing something?

multiplayergame manager
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Gosen Gao avatar image
Gosen Gao answered

You should shut down the server with the SessionId you used when you created the server. In your code, you are using a new random Guid as the SessionId, which will not get an error, but it cannot shut down the correct server instance. Please store the SessionId when creating a server so that it can be used to shut down the corresponding server later.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.