lloesche / valheim-server-docker

Valheim dedicated gameserver with automatic update, World backup, BepInEx and ValheimPlus mod support
https://hub.docker.com/r/lloesche/valheim-server
Apache License 2.0
1.94k stars 272 forks source link

Bug in valheim-server script #294

Closed thetaiter closed 3 years ago

thetaiter commented 3 years ago

I got a bunch of lines like this when my server when down for restart, and the server did not come back up.

/usr/local/bin/valheim-server: line 151: 14555 Killed                  wait $valheim_server_pid
/usr/local/bin/valheim-server: line 151: 14563 Killed                  wait $valheim_server_pid
/usr/local/bin/valheim-server: line 164: [: : integer expression expected
/usr/local/bin/valheim-server: line 151: 14566 Killed                  wait $valheim_server_pid
/usr/local/bin/valheim-server: line 164: [: : integer expression expected
/usr/local/bin/valheim-server: line 151: 14569 Killed                  wait $valheim_server_pid
/usr/local/bin/valheim-server: line 164: [: : integer expression expected
/usr/local/bin/valheim-server: line 151: 14571 Killed                  wait $valheim_server_pid
/usr/local/bin/valheim-server: line 164: [: : integer expression expected
/usr/local/bin/valheim-server: line 151: 14576 Killed                  wait $valheim_server_pid
/usr/local/bin/valheim-server: line 164: [: : integer expression expected
/usr/local/bin/valheim-server: line 151: 14583 Killed                  wait $valheim_server_pid
/usr/local/bin/valheim-server: line 128: 14046 Killed                  "$cmd_valheim_logfilter" -logtostderr -v "$VALHEIM_LOG_FILTER_VERBOSE"
/usr/local/bin/valheim-server: line 151: 14589 Killed                  wait $valheim_server_pid
/usr/local/bin/valheim-server: line 151: 14603 Killed                  wait $valheim_server_pid
/usr/local/bin/valheim-server: line 151: 14606 Killed                  wait $valheim_server_pid
/usr/local/bin/valheim-server: line 164: [: : integer expression expected
/usr/local/bin/valheim-server: line 151: 14614 Killed                  wait $valheim_server_pid
/usr/local/bin/valheim-server: line 164: [: : integer expression expected
/usr/local/bin/valheim-server: line 151: 14625 Killed                  wait $valheim_server_pid
/usr/local/bin/valheim-server: line 164: [: : integer expression expected
/usr/local/bin/valheim-server: line 151: 14629 Killed                  wait $valheim_server_pid
/usr/local/bin/valheim-server: line 164: [: : integer expression expected
/usr/local/bin/valheim-server: line 151: 14634 Killed                  wait $valheim_server_pid
/usr/local/bin/valheim-server: line 164: [: : integer expression expected
/usr/local/bin/valheim-server: line 151: 14638 Killed                  wait $valheim_server_pid
/usr/local/bin/valheim-server: line 151: 14041 Killed                  LD_PRELOAD=$SERVER_LD_PRELOAD "$valheim_server" -nographics -batchmode -name "$SERVER_NAME" -port "$SERVER_PORT" -world "$WORLD_NAME" -public "$SERVER_PUBLIC" "${password_args[@]}" $SERVER_ARGS > >(filter) 2>&1
lloesche commented 3 years ago

Do you have the complete log? From start to error.

thetaiter commented 3 years ago

What is the best way to do that? Supervisord splits the logs into stderr and stdout, so it is difficult to reconstruct the logs back in time order.

thetaiter commented 3 years ago

If this helps, it is happening during the nightly restart every night. Shutdown works successfully, but the server is never restarted.

thetaiter commented 3 years ago

Here are the relevant env variables I have set:

  DISCORD_WEBHOOK: <redacted>
  PRE_RESTART_HOOK: 'curl -sfSL -X POST -H "Content-Type: application/json" -d "{\"username\":\"Odin\",\"content\":\"Restarting server $SERVER_NAME in one minute!\"}" "$DISCORD_WEBHOOK" && sleep 60'
  VALHEIM_LOG_FILTER_CONTAINS_Spawned: "Got character ZDOID from"
  VALHEIM_LOG_FILTER_CONTAINS: 'Unity Log'
  ON_VALHEIM_LOG_FILTER_CONTAINS_Spawned: '{ read l; l=${l//*ZDOID from /}; l=${l// :*/}; msg="Player **$l** joined server **$SERVER_NAME**\nIP: **$(curl ipinfo.io/ip):$SERVER_PORT**"; curl -sfSL -X POST -H "Content-Type: application/json" -d "{\"username\":\"Odin\",\"content\":\"$msg\"}" "$DISCORD_WEBHOOK"; }'
  PRE_BOOTSTRAP_HOOK: 'curl -sfSL -X POST -H "Content-Type: application/json" -d "{\"username\":\"Odin\",\"content\":\"Starting server $SERVER_NAME.\nIP: **$(curl ipinfo.io/ip):$SERVER_PORT**\nThe server may take ~5 minutes to start up before you can connect.\"}" "$DISCORD_WEBHOOK"'
  SERVER_PUBLIC: true
  UPDATE_INTERVAL: 10800 # every 3 hours
  UPDATE_IF_IDLE: true
  RESTART_IF_IDLE: true
thetaiter commented 3 years ago

Also, the PRE_RESTART_HOOK does not fire.

lloesche commented 3 years ago

What is the best way to do that? Supervisord splits the logs into stderr and stdout, so it is difficult to reconstruct the logs back in time order.

Just attach two files? My guess is that the container doesn't have enough resources. See https://github.com/lloesche/valheim-server-docker#system-requirements

thetaiter commented 3 years ago

Bingo, that was it. Didn't have enough RAM allocated. Thanks!