docker-palworld-dedicated-server icon indicating copy to clipboard operation
docker-palworld-dedicated-server copied to clipboard

Docker shutdown signal not passed on

Open uncaught opened this issue 1 year ago • 8 comments

Have you read the Important information text above

  • [X] Yes i did

Current behavior

When stopping the container, it seems to get killed after the stop_grace_period (default 10s).

Desired behavior

The stop signal should be passed onto the underlying service so that it shuts down cleanly within the grace period.

If the clean shutdown takes longer than 10 seconds, the image should set a higher grace period.

Links to screenshots

No response

To Reproduce

Steps to reproduce the behavior:

  1. Stop the container
  2. See it always stops after 10 seconds

Software setup

  • OS: Ubuntu 22.04
  • Docker: 24.0.4
  • Docker compose: 2.19.1

Hardware setup

  • vCPU: 6
  • RAM: 16G
  • Disk: 280G SSD

Additional context

No response

uncaught avatar Jan 21 '24 10:01 uncaught

This would be helpful since the server needs rebooted every 2 hours due to memory leak.

0Downtime avatar Jan 21 '24 13:01 0Downtime

Hey @uncaught Looks to me like this is the problem? https://docs.docker.com/compose/faq/#why-do-my-services-take-10-seconds-to-recreate-or-stop

jammsen avatar Jan 21 '24 22:01 jammsen

Yes, your entrypoint (servermanager.sh) needs to delegate the signals to the services it starts.

I don't know where PalServer.sh comes from, but if that handles a shutdown signal (the docker stop signal can be adjusted), then maybe this could already do the trick:

-    ./PalServer.sh "$START_OPTIONS"
+    exec ./PalServer.sh "$START_OPTIONS"

exec will replace the top level process, so the signals go there now.

Not sure if you need your own process running still though.

uncaught avatar Jan 22 '24 08:01 uncaught

Hey @uncaught the PalServer.sh comes with the server, it sets some unreal-engine things. PalServer.sh:

#!/bin/sh
UE_TRUE_SCRIPT_NAME=$(echo \"$0\" | xargs readlink -f)
UE_PROJECT_ROOT=$(dirname "$UE_TRUE_SCRIPT_NAME")
chmod +x "$UE_PROJECT_ROOT/Pal/Binaries/Linux/PalServer-Linux-Test"
"$UE_PROJECT_ROOT/Pal/Binaries/Linux/PalServer-Linux-Test" Pal "$@" 

But im working on a fix for that, a collegue of mine has something the might work and he was okay with me using it.

jammsen avatar Jan 22 '24 10:01 jammsen

Fix is applied in my local version:

Console

palworld-dedicated-server  | [S_API FAIL] Tried to access Steam interface SteamUser021 before SteamAPI_Init succeeded.
palworld-dedicated-server  | [S_API FAIL] Tried to access Steam interface SteamFriends017 before SteamAPI_Init succeeded.
palworld-dedicated-server  | [S_API FAIL] Tried to access Steam interface STEAMAPPS_INTERFACE_VERSION008 before SteamAPI_Init succeeded.
palworld-dedicated-server  | [S_API FAIL] Tried to access Steam interface SteamNetworkingUtils004 before SteamAPI_Init succeeded.
^CGracefully stopping... (press Ctrl+C again to force)
[+] Stopping 1/1
 ✔ Container palworld-dedicated-server  Stopped                                                                                                     3.3s
palworld-dedicated-server exited with code 0
canceled

3.3 instead of 10 🚀

docker-compose logs -f

palworld-dedicated-server  | [S_API FAIL] Tried to access Steam interface SteamUser021 before SteamAPI_Init succeeded.
palworld-dedicated-server  | [S_API FAIL] Tried to access Steam interface SteamFriends017 before SteamAPI_Init succeeded.
palworld-dedicated-server  | [S_API FAIL] Tried to access Steam interface STEAMAPPS_INTERFACE_VERSION008 before SteamAPI_Init succeeded.
palworld-dedicated-server  | [S_API FAIL] Tried to access Steam interface SteamNetworkingUtils004 before SteamAPI_Init succeeded.
palworld-dedicated-server  | FUnixPlatformMisc::RequestExitWithStatus
palworld-dedicated-server  | FUnixPlatformMisc::RequestExit
palworld-dedicated-server  | dlmopen steamservice.so failed: steamservice.so: cannot open shared object file: No such file or directory
palworld-dedicated-server  | Exiting abnormally (error code: 143)
palworld-dedicated-server  | Shutdown handler: cleanup.

This should do the trick i think. @uncaught

jammsen avatar Jan 22 '24 12:01 jammsen

3.3 seconds sounds good :)

uncaught avatar Jan 22 '24 12:01 uncaught

Please go ahead and test things. New Docker-Compose File is needed. You can find now examples in the README.md. The docker-compose.yml was removed because of dublicate code.

jammsen avatar Jan 22 '24 14:01 jammsen

If this issue is solved, please give me feedback on the patch and please consider giving me a Star here and on Docker-Hub.

jammsen avatar Jan 23 '24 00:01 jammsen

@uncaught Ping please read the last 2 comments and tell me things

jammsen avatar Jan 23 '24 10:01 jammsen

I've seen it, but can't test, yet. I've been shutting down the server via rcon lately and it's not running right now. (Damn memory leak ;) )

I've been using the updated script though already since yesterday.

I'm going to assume this is solved (until they change the name of PalServer-Linux-Test I guess ;) ).

uncaught avatar Jan 23 '24 10:01 uncaught

Well its their binary and their shell-script, up to them to manage that beast, hehe 👍

jammsen avatar Jan 23 '24 10:01 jammsen