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.92k stars 269 forks source link

Unable to connect - PARTY_STATE_CHANGE_RESULT_INTERNET_CONNECTIVITY_ERROR #516

Closed recursiveGecko closed 1 year ago

recursiveGecko commented 1 year ago

Hi, I'm trying to set up a crossplay server using Nomad and it seems like something is going wrong. The server is running, only listening on port 2457 (ss -4ln) and it's not visible in the in-game browser in the Community tab (Game Pass version).

The recurring error seems to be "PARTY_STATE_CHANGE_RESULT_INTERNET_CONNECTIVITY_ERROR" even though all ports 2456-2458 are exposed.

Nomad config:

variable "valheim_root" {
  type        = string
  description = "Host path to root Valheim dir"
  default = "/srv/valheim"
}

job "valheim-game-server" {
  datacenters = ["dc1"]
  type        = "service"

  group "valheim" {
    count = 1

    network {
      mode = "bridge"

      port "valheim_game" {
        static = 2456
      }

      port "valheim_query" {
        static = 2457
      }

      port "valheim_3" {
        static = 2458
      }
    }

    task "valheim-main" {
      driver = "docker"

      config {
        image        = "lloesche/valheim-server"

        volumes = [
          "${var.valheim_root}/config:/config",
          "${var.valheim_root}/data:/opt/valheim",
        ]

        ports = ["valheim_game", "valheim_query", "valheim_3"]
      }

      env {
          SERVER_ARGS = "-crossplay"
          SERVER_NAME = "MyServerName"
          WORLD_NAME = "MyWorld"
          SERVER_PASS = "MyPassword"
          SERVER_PUBLIC =true
          BACKUPS = true
          BACKUPS_IF_IDLE = false
          BACKUPS_IDLE_GRACE_PERIOD = 3600
          PUID = 1000
          PGID = 1000
      }

      resources {
        cpu    = 1000
        memory = 4096
      }
    }
  }
}

Logs:

Nov  6 18:00:03 supervisord: valheim-server 11/06/2022 18:00:03: Using default prefs
Nov  6 18:00:03 supervisord: valheim-server 11/06/2022 18:00:03: isModded: False
Nov  6 18:00:03 supervisord: valheim-server 11/06/2022 18:00:03: Zonesystem Awake 404
Nov  6 18:00:03 supervisord: valheim-server 11/06/2022 18:00:03: DungeonDB Awake 404
Nov  6 18:00:03 supervisord: valheim-server 11/06/2022 18:00:03: Registering lobby
Nov  6 18:00:03 supervisord: valheim-server 11/06/2022 18:00:03: PlayFab custom ID set to "PlayFab_MyServerName_REDACTED"
Nov  6 18:00:04 supervisord: valheim-server DEBUG - [129] - Waiting for server to listen on UDP port 2456
Nov  6 18:00:06 supervisord: valheim-server 11/06/2022 18:00:06: Audioman already exist, destroying self
Nov  6 18:00:06 supervisord: valheim-server 11/06/2022 18:00:06: PlayFab logged in as "PlayFab_MyServerName_REDACTED"
Nov  6 18:00:06 supervisord: valheim-server 11/06/2022 18:00:06: PlayFab local entity ID is F6REDACTED
Nov  6 18:00:06 supervisord: valheim-server 11/06/2022 18:00:06: New session server "MyServerName" that has join code , now 0 player(s)
Nov  6 18:00:06 supervisord: valheim-server 11/06/2022 18:00:06: Register PlayFab server "MyServerName" with IP REDACTED:2456
Nov  6 18:00:06 supervisord: valheim-server 11/06/2022 18:00:06: Server 'MyServerName' begin PlayFab create and join network for server 
Nov  6 18:00:06 supervisord: valheim-server Unloading 527 unused Assets to reduce memory usage. Loaded Objects now: 106150.
Nov  6 18:00:06 supervisord: valheim-server Total: 65.489433 ms (FindLiveObjects: 5.084911 ms CreateObjectMapping: 7.702464 ms MarkObjects: 51.443505 ms  DeleteObjects: 1.257626 ms)
Nov  6 18:00:09 supervisord: valheim-server 11/06/2022 18:00:09: Zonesystem Start 404
2022-11-06 18:00:09,643 INFO success: valheim-server entered RUNNING state, process has stayed up for > than 10 seconds (startsecs)
Nov  6 18:00:09 supervisord: valheim-server DEBUG - [129] - Waiting for server to listen on UDP port 2456
Nov  6 18:00:09 supervisord: valheim-updater valheim-server: started
Nov  6 18:00:09 supervisord: valheim-updater DEBUG - [36] - Received signal to check for update
Nov  6 18:00:09 supervisord: valheim-server 11/06/2022 18:00:09: Added 3 locations, 0 vegetations, 0 environments, 0 biome env-setups from locations_cp1
Nov  6 18:00:09 supervisord: valheim-server 11/06/2022 18:00:09: Added 1 locations, 0 vegetations, 1 environments, 0 biome env-setups from locations_mountaincaves
Nov  6 18:00:09 supervisord: valheim-server 11/06/2022 18:00:09: DungeonDB Start 404
Nov  6 18:00:10 supervisord: valheim-server 11/06/2022 18:00:10: ZRpc timeout set to 30s 
Nov  6 18:00:10 supervisord: valheim-server 11/06/2022 18:00:10: Load world: MyWorld (MyWorld)
Nov  6 18:00:10 supervisord: valheim-server 11/06/2022 18:00:10: Loading 81 zdos , my id 574247899 data version:28
Nov  6 18:00:10 supervisord: valheim-server 11/06/2022 18:00:10: Loaded 0 dead zdos
Nov  6 18:00:10 supervisord: valheim-server 11/06/2022 18:00:10: Removed 0 OLD generated ZDOS
Nov  6 18:00:10 supervisord: valheim-server 11/06/2022 18:00:10: Loaded 7469 locations
Nov  6 18:00:10 supervisord: valheim-server The shader Hidden/Dof/DepthOfFieldHdr (UnityEngine.Shader) on effect Main Camera (UnityStandardAssets.ImageEffects.DepthOfField) is not supported on this platform!
Nov  6 18:00:10 supervisord: valheim-server The image effect Main Camera (UnityStandardAssets.ImageEffects.DepthOfField) has been disabled as it's not supported on the current platform.
Nov  6 18:00:10 supervisord: valheim-server The shader Hidden/SunShaftsComposite (UnityEngine.Shader) on effect Main Camera (UnityStandardAssets.ImageEffects.SunShafts) is not supported on this platform!
Nov  6 18:00:10 supervisord: valheim-server The shader Hidden/SimpleClear (UnityEngine.Shader) on effect Main Camera (UnityStandardAssets.ImageEffects.SunShafts) is not supported on this platform!
Nov  6 18:00:10 supervisord: valheim-server The image effect Main Camera (UnityStandardAssets.ImageEffects.SunShafts) has been disabled as it's not supported on the current platform.
Nov  6 18:00:10 supervisord: valheim-server 11/06/2022 18:00:10: Game server connected
Nov  6 18:00:11 supervisord: valheim-server PARTY_STATE_CHANGE_RESULT_INTERNET_CONNECTIVITY_ERROR
Nov  6 18:00:11 supervisord: valheim-server the ping to the quality of service beacon timed out
Nov  6 18:00:13 supervisord: valheim-server PARTY_STATE_CHANGE_RESULT_INTERNET_CONNECTIVITY_ERROR
Nov  6 18:00:13 supervisord: valheim-server the ping to the quality of service beacon timed out
Nov  6 18:00:13 supervisord: valheim-server PARTY_STATE_CHANGE_RESULT_INTERNET_CONNECTIVITY_ERROR
Nov  6 18:00:13 supervisord: valheim-server the region list could not be determined
Nov  6 18:00:13 supervisord: valheim-server the network operation cannot complete because creating the network failed
Nov  6 18:00:13 supervisord: valheim-server PARTY_STATE_CHANGE_RESULT_NETWORK_NO_LONGER_EXISTS
Nov  6 18:00:13 supervisord: valheim-server the network operation cannot complete because creating the network failed
Nov  6 18:00:14 supervisord: valheim-server DEBUG - [129] - Waiting for server to listen on UDP port 2456
Nov  6 18:00:16 supervisord: valheim-server Failed to send session data. Error: /Event/WriteTelemetryEvents: The requesting entity is not authorized to write events with namespace playfab.party. Allowed namespaces can be 'custom' or begin with 'custom.'.
Nov  6 18:00:19 supervisord: valheim-server DEBUG - [129] - Waiting for server to listen on UDP port 2456
Nov  6 18:00:24 supervisord: valheim-server DEBUG - [129] - Waiting for server to listen on UDP port 2456
Nov  6 18:00:29 supervisord: valheim-server DEBUG - [129] - Waiting for server to listen on UDP port 2456
Nov  6 18:00:34 supervisord: valheim-server DEBUG - [129] - Waiting for server to listen on UDP port 2456
Nov  6 18:00:39 supervisord: valheim-server DEBUG - [129] - Waiting for server to listen on UDP port 2456
Nov  6 18:00:40 supervisord: valheim-server 11/06/2022 18:00:40: PlayFab reconnect server 'MyServerName'
Nov  6 18:00:40 supervisord: valheim-server 11/06/2022 18:00:40: Server 'MyServerName' begin PlayFab create and join network for server 
Nov  6 18:00:44 supervisord: valheim-server PARTY_STATE_CHANGE_RESULT_INTERNET_CONNECTIVITY_ERROR
Nov  6 18:00:44 supervisord: valheim-server the ping to the quality of service beacon timed out
Nov  6 18:00:44 supervisord: valheim-server PARTY_STATE_CHANGE_RESULT_INTERNET_CONNECTIVITY_ERROR
Nov  6 18:00:44 supervisord: valheim-server the region list could not be determined
Nov  6 18:00:44 supervisord: valheim-server the network operation cannot complete because creating the network failed
Nov  6 18:00:44 supervisord: valheim-server PARTY_STATE_CHANGE_RESULT_NETWORK_NO_LONGER_EXISTS
Nov  6 18:00:44 supervisord: valheim-server the network operation cannot complete because creating the network failed
Nov  6 18:00:44 supervisord: valheim-server DEBUG - [129] - Waiting for server to listen on UDP port 2456
recursiveGecko commented 1 year ago

Figured it out.

It seems like the game is using a random ephemeral UDP port in the 30k+ range to connect to PlayFab services. My dedicated server is hosted at Hetzner which imposes a stateless firewall (without connection tracking), which breaks things like outgoing TCP and UDP connections.

I had to allow in a wide range of UDP ports (sysctl net.ipv4.ip_local_port_range) through Hetzner's dashboard. This is in addition to the firewall rules on the server, which are just 2456-2458/udp.

image