About the shutdown grace

Hi there,

Until recently I wasn’t using the shutdown grace parameter, so the value in the config file was 0. But we need our matches to have more time when we are closing the server. So I edited the value, but whenever I stop nakama, the grace won’t exceed 10 seconds. Is that normal (the highest cap) or did I missed something. (I’m testing with docker)

Thanks in advance for the answer

Can you explain a bit more what you mean by this?

The grace period is the maximum amount of time the server will give authoritative matches to close. If they close before the grace period ends, or if there are no authoritative matches running, the server will stop sooner.

For example, my current testing setup is two authoritative match running.
When calling Match_Terminate, ,I’m launching the process to end it safely, but it take some times (turned base card game, so I’m waiting for the end of the turn).
I also placed a logger.Info in the function to see when the function is called. From a second terminal (in the same running folder) I call docker-compose down.
From the time I see the log from Terminate function, if the grace period is > 10s, at 10sec, “nakama exited with code 173” showed. But if I set less than 10 seconds, it does stop after the grace period.

@androuin.remi This doesn’t have anything to do with Nakama and its shutdown_grace_sec option. The server is correct but you’ve not read the documentation on what docker-compose down subcommand does.


You can see from the documentation that there’s an optional argument used to configure the length of time granted for the container to be stopped gracefully. It defaults to 10 seconds.

-t, --timeout TIMEOUT Specify a shutdown timeout in seconds. (default: 10)

Thanks a lot for the answer.
Indeed I didn’t saw that part of the docker documentation.

1 Like