itzg / docker-minecraft-server

Docker image that provides a Minecraft Server that will automatically download selected version at startup
https://docker-minecraft-server.readthedocs.io/
Apache License 2.0
9.17k stars 1.52k forks source link

When proxy-protocol set to true, autostop no longer working. #2828

Closed ajarmoszuk closed 4 months ago

ajarmoszuk commented 4 months ago

Describe the problem

When proxy-protocol is set to true inside config/paper-global.yml the autostop functionality is no longer working, once set to false we get "[Autostop loop] MC Server listening for connections - stopping in 600 seconds" inside the logs, otherwise it does not appear and does not seem to be working as designed.

Server version is Paper 1.20.4. Using newest available docker image. I've also tested with the newest Paper version and the same issue appears.

Container definition

container = docker_client.containers.run(
        image='itzg/minecraft-server:latest',
        name=actual_server_name,
        detach=True,
        network="restricted-network",
        ports={'25565': f'{server_port}/tcp'},
        environment={
        'EULA': 'true',
        'TYPE': 'CUSTOM',
        'CUSTOM_SERVER': 'server.jar',
        'USE_AIKAR_FLAGS': 'true',
        'ENABLE_ROLLING_LOGS': 'true',
        'CREATE_CONSOLE_IN_PIPE': 'true',
        'MAX_PLAYERS': '10',
        'MEMORY': '1G',
        'INIT_MEMORY': '512M',
        'MAX_MEMORY': '1G',
        'ONLINE_MODE': 'false',
        'ENABLE_AUTOSTOP': 'TRUE',
        'AUTOSTOP_TIMEOUT_EST': '1800',
        'AUTOSTOP_TIMEOUT_INIT': '600',
        },
        volumes={
            f'/home/minecraft/servers/{actual_server_name}': {'bind': '/data', 'mode': 'rw'},
            '/home/minecraft/custom_files/server.jar': {'bind': '/data/server.jar', 'mode': 'ro'},
        },
        cpu_period=100000,  # Set the CPU period (microseconds)
        cpu_quota=150000, # 150% CPU Time
        mem_limit='2G',  # Memory limit
        memswap_limit='2G',  # Swap limit
    )

Container logs

[init] Running as uid=1000 gid=1000 with /data as 'drwxrwxr-x 12 1000 1000 4096 May 16 23:13 /data'
[init] Autostop functionality enabled
[init] Resolving type given CUSTOM
[init] **********************************************************************
[init] WARNING: Some mods and modpacks may require Java 8.
[init]          Please use itzg/minecraft-server:java8
[init] **********************************************************************
[mc-image-helper] 23:30:08.902 INFO  : Created/updated 2 properties in /data/server.properties
[init] log4j2.xml already created, skipping
[init] Using Aikar's flags
[init] Setting initial memory to 512M and max to 1G
[init] Starting the Minecraft server...
Starting org.bukkit.craftbukkit.Main
*** Warning, you've not updated in a while! ***
*** Please download a new build as per instructions from https://papermc.io/downloads/paper ***
System Info: Java 17 (OpenJDK 64-Bit Server VM 17.0.10+7) Host: Linux 5.15.0-105-generic (amd64)
Loading libraries, please wait...
[23:30:28] [ServerMain/INFO]: Environment: Environment[sessionHost=https://sessionserver.mojang.com, servicesHost=https://api.minecraftservices.com, name=PROD]
[23:30:33] [ServerMain/INFO]: Loaded 1174 recipes
[23:30:34] [ServerMain/INFO]: Loaded 1271 advancements
[23:30:34] [Server thread/INFO]: Starting minecraft server version 1.20.4
[23:30:34] [Server thread/INFO]: Loading properties
[23:30:34] [Server thread/INFO]: This server is running Paper version git-Paper-430 (MC: 1.20.4) (Implementing API version 1.20.4-R0.1-SNAPSHOT) (Git: 4939f87)
[23:30:36] [Server thread/INFO]: Server Ping Player Sample Count: 12
[23:30:36] [Server thread/INFO]: Using 4 threads for Netty based IO
[23:30:37] [Server thread/WARN]: [!] The timings profiler has been enabled but has been scheduled for removal from Paper in the future.
    We recommend installing the spark profiler as a replacement: https://spark.lucko.me/
    For more information please visit: https://github.com/PaperMC/Paper/issues/8948
[23:30:37] [Server thread/INFO]: Chunk system is using 1 I/O threads, 1 worker threads, and gen parallelism of 1 threads
[23:30:38] [Server thread/INFO]: Default game type: SURVIVAL
[23:30:38] [Server thread/INFO]: Generating keypair
[23:30:38] [Server thread/INFO]: Starting Minecraft server on *:25565
[23:30:38] [Server thread/INFO]: Using epoll channel type
[23:30:38] [Server thread/INFO]: Paper: Using libdeflate (Linux x86_64) compression from Velocity.
[23:30:38] [Server thread/INFO]: Paper: Using OpenSSL 1.1.x (Linux x86_64) cipher from Velocity.
[23:30:39] [Server thread/INFO]: Loading server plugin Essentials v2.20.1
[23:30:39] [Server thread/INFO]: Loading server plugin WorldEdit v7.2.18+6616-abda4e0
[23:30:41] [Server thread/INFO]: Got request to register class com.sk89q.worldedit.bukkit.BukkitServerInterface with WorldEdit [com.sk89q.worldedit.extension.platform.PlatformManager@f62182e]
[23:30:41] [Server thread/INFO]: Loading server plugin ProtocolLib v5.2.0-SNAPSHOT-679
[23:30:44] [Server thread/INFO]: Loading server plugin EssentialsSpawn v2.20.1
[23:30:44] [Server thread/INFO]: Loading server plugin WorldGuard v7.0.9+5934e49
[23:30:44] [Server thread/INFO]: Loading server plugin EssentialsChat v2.20.1
[23:30:44] [Server thread/INFO]: Loading server plugin AuthMe v5.6.0-SNAPSHOT-b2614
[23:30:44] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it
[23:30:44] [Server thread/INFO]: Enabling WorldEdit v7.2.18+6616-abda4e0
[23:30:44] [Server thread/INFO]: Registering commands with com.sk89q.worldedit.bukkit.BukkitServerInterface
[23:30:45] [Server thread/INFO]: WEPIF: Using the Bukkit Permissions API.
[23:30:45] [Server thread/INFO]: Using com.sk89q.worldedit.bukkit.adapter.impl.v1_20_R3.PaperweightAdapter as the Bukkit adapter
[23:30:48] [Server thread/INFO]: Enabling ProtocolLib v5.2.0-SNAPSHOT-679
[23:30:48] [Server thread/WARN]: **** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!
[23:30:48] [Server thread/WARN]: The server will make no attempt to authenticate usernames. Beware.
[23:30:48] [Server thread/WARN]: While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.
[23:30:48] [Server thread/WARN]: To change this, set "online-mode" to "true" in the server.properties file.
[23:30:48] [Server thread/INFO]: Preparing level "world"
[23:30:51] [Server thread/INFO]: Preparing start region for dimension minecraft:overworld
[23:30:52] [Server thread/INFO]: Time elapsed: 1105 ms
[23:30:52] [Server thread/INFO]: Preparing start region for dimension minecraft:the_nether
[23:30:52] [Server thread/INFO]: Time elapsed: 204 ms
[23:30:52] [Server thread/INFO]: Preparing start region for dimension minecraft:the_end
[23:30:53] [Server thread/INFO]: Time elapsed: 197 ms
[23:30:53] [Server thread/INFO]: Enabling Essentials v2.20.1
[23:30:53] [Server thread/ERROR]: You are running an unsupported server version!
[23:30:55] [Server thread/INFO]: Attempting to convert old kits in config.yml to new kits.yml
[23:30:55] [Server thread/INFO]: No kits found to migrate.
[23:30:55] [Server thread/INFO]: Starting Essentials ban format conversion
[23:30:55] [Server thread/INFO]: Attempting to migrate ignore list to UUIDs
[23:30:55] [Server thread/INFO]: Attempting to migrate legacy userdata keys to Configurate
[23:30:55] [Server thread/INFO]: Loaded 39094 items from items.json.
[23:30:56] [Server thread/INFO]: Using locale en_US
[23:30:56] [Server thread/INFO]: ServerListPingEvent: Spigot iterator API
[23:30:56] [Server thread/INFO]: Starting Metrics. Opt-out using the global bStats config.
[23:30:56] [Server thread/INFO]: Using superperms-based permissions.
[23:30:56] [Server thread/INFO]: Enabling EssentialsSpawn v2.20.1
[23:30:56] [Server thread/INFO]: Starting Metrics. Opt-out using the global bStats config.
[23:30:56] [Server thread/INFO]: Enabling WorldGuard v7.0.9+5934e49
[23:30:57] [Server thread/INFO]: [WorldGuard] (world) TNT ignition is PERMITTED.
[23:30:57] [Server thread/INFO]: [WorldGuard] (world) Lighters are PERMITTED.
[23:30:57] [Server thread/INFO]: [WorldGuard] (world) Lava fire is PERMITTED.
[23:30:57] [Server thread/INFO]: [WorldGuard] (world) Fire spread is UNRESTRICTED.
[23:30:57] [Server thread/INFO]: [WorldGuard] Loaded configuration for world 'world'
[23:30:57] [Server thread/INFO]: [WorldGuard] (world_nether) TNT ignition is PERMITTED.
[23:30:57] [Server thread/INFO]: [WorldGuard] (world_nether) Lighters are PERMITTED.
[23:30:57] [Server thread/INFO]: [WorldGuard] (world_nether) Lava fire is PERMITTED.
[23:30:57] [Server thread/INFO]: [WorldGuard] (world_nether) Fire spread is UNRESTRICTED.
[23:30:57] [Server thread/INFO]: [WorldGuard] Loaded configuration for world 'world_nether'
[23:30:57] [Server thread/INFO]: [WorldGuard] (world_the_end) TNT ignition is PERMITTED.
[23:30:57] [Server thread/INFO]: [WorldGuard] (world_the_end) Lighters are PERMITTED.
[23:30:57] [Server thread/INFO]: [WorldGuard] (world_the_end) Lava fire is PERMITTED.
[23:30:57] [Server thread/INFO]: [WorldGuard] (world_the_end) Fire spread is UNRESTRICTED.
[23:30:57] [Server thread/INFO]: [WorldGuard] Loaded configuration for world 'world_the_end'
[23:30:57] [Server thread/INFO]: [WorldGuard] Loading region data...
[23:30:58] [Server thread/INFO]: Enabling EssentialsChat v2.20.1
[23:30:58] [Server thread/INFO]: Starting Metrics. Opt-out using the global bStats config.
[23:30:58] [Server thread/INFO]: Enabling AuthMe v5.6.0-SNAPSHOT-b2614
[23:30:59] [Server thread/INFO]: SQLite Setup finished
[23:30:59] [Server thread/INFO]: No supported permissions system found! Permissions are disabled!
[23:30:59] [Server thread/INFO]: Hooked successfully into Essentials
[23:30:59] [Server thread/INFO]: Essentials spawn file not found: '/data/plugins/Essentials/spawn.yml'
[23:31:00] [Server thread/INFO]: AuthMe 5.6.0-SNAPSHOT build n.2614 successfully enabled!
[23:31:00] [Server thread/INFO]: Starting remote control listener
[23:31:00] [Server thread/INFO]: Thread RCON Listener started
[23:31:00] [Server thread/INFO]: RCON running on 0.0.0.0:25575
[23:31:00] [Server thread/INFO]: Running delayed init tasks
[23:31:00] [Craft Scheduler Thread - 1 - AuthMe/INFO]: Downloading GEO IP database, because the old database is older than 30 days or doesn't exist
[23:31:00] [Server thread/INFO]: Done (26.078s)! For help, type "help"
[23:31:00] [Craft Scheduler Thread - 3 - Essentials/INFO]: Fetching version information...
[23:31:00] [Craft Scheduler Thread - 1 - AuthMe/WARN]: No MaxMind credentials found in the configuration file! GeoIp protections will be disabled.
[23:31:00] [Craft Scheduler Thread - 1 - AuthMe/INFO]: There is no newer GEO IP database uploaded to MaxMind. Using the old one for now.
[23:31:00] [Server thread/INFO]: Timings Reset
[23:31:00] [Craft Scheduler Thread - 1 - AuthMe/WARN]: Could not download GeoLiteAPI database [FileNotFoundException]: plugins/AuthMe/GeoLite2-Country.mmdb (No such file or directory)
[23:31:04] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 2510ms or 50 ticks behind
ajarmoszuk commented 4 months ago

I've provided a fix for this issue inside pull request #2832. Once pulled it will allow to you to set MC_HEALTH_EXTRA_ARGS to "--use-proxy" which will allow for mc-monitor to monitor servers that have proxy-protocol set to true.

itzg commented 4 months ago

For future reference, leave the issue open and allow Github to auto-close the issue when the linked PR is merged. I'll go ahead and add the linkage.