CubeCoders / AMP

Issue tracking and documentation for AMP
https://cubecoders.com/AMP
207 stars 38 forks source link

Minecraft 1.20.4 Sleep mode Unable to get protocol version #955

Closed p0t4t0sandwich closed 10 months ago

p0t4t0sandwich commented 11 months ago

Bug Report

System Information

I confirm:

Symptoms

AMP throws an error regarding decoding the server's response, and the server can't sleep as a result.

[05:48:46] [Logger Info]          : Starting AMP version 2.4.6.10 (Decadeus), built 06/12/2023 17:17
[05:48:46] [Logger Info]          : Stream: Mainline / Release - built by CUBECODERS/buildbot on CCL-DEV
[05:48:46] [Logger Info]          : Running in a Docker environment.
[05:48:46] [Logger Info]          : Purging old audit logs (this may take a moment)...
[05:48:46] [Logger Info]          : OS: Linux / x86_64
[05:48:46] [Logger Info]          : CPU: Common KVM processor (2C/2T)
[05:48:46] [Logger Info]          : RAM: 11957MB
[05:48:46] [Logger Info]          : AMP Instance ID: e40f6d93-f0f0-45bf-930d-4892df08bdf3
[05:48:48] [Logger Info]          : Loaded MinecraftModule version 1.0.0.3 by CubeCoders Limited
[05:48:48] [Logger Info]          : Metrics publishing is enabled at udp://172.16.1.172:12820.
[05:48:48] [Logger Info]          : Loaded FileManagerPlugin by CubeCoders Limited
[05:48:48] [Logger Info]          : Loaded EmailSenderPlugin by CubeCoders Limited
[05:48:48] [Logger Info]          : Loaded WebRequestPlugin by CubeCoders Limited
[05:48:48] [Logger Info]          : Loaded LocalFileBackupPlugin by CubeCoders Limited
[05:48:48] [Logger Info]          : Loaded CommonCorePlugin by CubeCoders Limited
[05:48:49] [Logger Info]          : Licence Present: AMP Advanced Edition
[05:48:50] [Logger Notice]        : Using keypair with fingerprint FI+kWGARn3vLFIPTjygicc5dRhKIH/tiO4Xwl2JRgNY=
[05:48:50] [Logger Info]          : SFTP Server started on 0.0.0.0:2231
[05:48:50] [Webserver Info]       : Websockets are enabled.
[05:48:50] [Logger Info]          : RouterTimer@10Hz with 2 jobs started
[05:48:50] [Logger Info]          : Webserver started on http://0.0.0.0:8088
[05:48:50] [Core Info]            : Checking for AMP updates...
[05:48:50] [Logger Info]          : Startup mode is StartApplication.
[05:48:50] [Logger Info]          : Java located at /usr/lib/jvm/temurin-18-jdk-amd64/bin/java
[05:48:51] [Core Info]            : AMP is up to date.
[05:48:52] [Logger Warning]       : Unable to get Bedrock version data from https://www.minecraft.net/en-us/download/server/bedrock: Data not found.
[05:48:54] [Logger Info]          : Modpack cache is up-to-date.
[05:49:12] [Logger Activity]      : Authentication attempt for user dylan from 127.0.0.1
[05:49:13] [Logger Activity]      : Authentication failure for user dylan from 127.0.0.1 - TokenRejected
[05:49:17] [Logger Warning]       : Slow method invocation: Login took 5681ms to complete.
[05:49:17] [Logger Warning]       : Slow response: Core.Login took 5686ms to complete.
[05:49:17] [Logger Info]          : Using 'Official' compatibility mode.
Starting net.minecraft.server.Main
[05:49:33] [ServerMain/INFO]: Environment: Environment[sessionHost=https://sessionserver.mojang.com, servicesHost=https://api.minecraftservices.com, name=PROD]
[05:49:42] [ServerMain/INFO]: Loaded 7 recipes
[05:49:44] [ServerMain/INFO]: Loaded 1271 advancements
[05:49:47] [Server thread/INFO]: Starting minecraft server version 1.20.4
[05:49:47] [Server thread/INFO]: Loading properties
[05:49:47] [Server thread/INFO]: Default game type: SURVIVAL
[05:49:47] [Server thread/INFO]: Generating keypair
[05:49:47] [Server thread/INFO]: Starting Minecraft server on 0.0.0.0:25568
[05:49:48] [Server thread/INFO]: Using epoll channel type
[05:49:48] [Server thread/INFO]: Preparing level "world"
[05:50:04] [Server thread/INFO]: Preparing start region for dimension minecraft:overworld
[05:50:34] [Worker-Main-1/INFO]: Preparing spawn area: 15%
[05:50:35] [Worker-Main-1/INFO]: Preparing spawn area: 67%
[05:50:35] [Worker-Main-1/INFO]: Preparing spawn area: 68%
[05:50:36] [Worker-Main-2/INFO]: Preparing spawn area: 69%
[05:50:37] [Worker-Main-1/INFO]: Preparing spawn area: 71%
[05:50:37] [Worker-Main-1/INFO]: Preparing spawn area: 73%
[05:50:38] [Worker-Main-1/INFO]: Preparing spawn area: 77%
[05:50:39] [Worker-Main-1/INFO]: Preparing spawn area: 78%
[05:50:49] [Worker-Main-1/INFO]: Preparing spawn area: 79%
[05:50:49] [Worker-Main-1/INFO]: Preparing spawn area: 80%
[05:50:52] [Worker-Main-1/INFO]: Preparing spawn area: 81%
[05:50:53] [Worker-Main-1/INFO]: Preparing spawn area: 84%
[05:50:56] [Worker-Main-1/INFO]: Preparing spawn area: 85%
[05:50:56] [Worker-Main-1/INFO]: Preparing spawn area: 88%
[05:50:59] [Worker-Main-1/INFO]: Preparing spawn area: 89%
[05:50:59] [Worker-Main-1/INFO]: Preparing spawn area: 90%
[05:51:00] [Worker-Main-1/INFO]: Preparing spawn area: 91%
[05:51:07] [Worker-Main-1/INFO]: Preparing spawn area: 92%
[05:51:08] [Worker-Main-1/INFO]: Preparing spawn area: 94%
[05:51:12] [Worker-Main-1/INFO]: Preparing spawn area: 95%
[05:51:13] [Worker-Main-1/INFO]: Preparing spawn area: 96%
[05:51:27] [Server thread/INFO]: Time elapsed: 83003 ms
[05:51:27] [Server thread/INFO]: Done (98.602s)! For help, type "help"
[05:51:29] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 2207ms or 44 ticks behind
[05:51:31] [Minecraft Warning]    : AMP wasn't able to understand the response from the Minecraft server, sleep mode is not possible.
[05:51:31] [Core Error]           : JsonSerializationException
[05:51:31] [Logger Error]         : [0] (JsonSerializationException) : Error converting value "Powered by AMP" to type 'MinecraftModule.SleepServer.ServerDescription'. Path 'description', line 1, position 5763.
[05:51:31] [Core Error]           :   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType (Newtonsoft.Json.JsonReader reader, Object value, Globalization.CultureInfo culture, Newtonsoft.Json.Serialization.JsonContract contract, Type targetType) 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal (Newtonsoft.Json.JsonReader reader, Type objectType, Newtonsoft.Json.Serialization.JsonContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerMember, Object existingValue) 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue (Newtonsoft.Json.Serialization.JsonProperty property, Newtonsoft.Json.JsonConverter propertyConverter, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty, Newtonsoft.Json.JsonReader reader, Object target) 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject (Object newObject, Newtonsoft.Json.JsonReader reader, Newtonsoft.Json.Serialization.JsonObjectContract contract, Newtonsoft.Json.Serialization.JsonProperty member, String id) 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject (Newtonsoft.Json.JsonReader reader, Type objectType, Newtonsoft.Json.Serialization.JsonContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerMember, Object existingValue) 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal (Newtonsoft.Json.JsonReader reader, Type objectType, Newtonsoft.Json.Serialization.JsonContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerMember, Object existingValue) 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader, Type objectType, Boolean checkAdditionalContent) 
  at Newtonsoft.Json.JsonSerializer.DeserializeInternal (Newtonsoft.Json.JsonReader reader, Type objectType) 
  at Newtonsoft.Json.JsonSerializer.Deserialize (Newtonsoft.Json.JsonReader reader, Type objectType) 
  at Newtonsoft.Json.JsonConvert.DeserializeObject (String value, Type type, Newtonsoft.Json.JsonSerializerSettings settings) 
  at Newtonsoft.Json.JsonConvert.DeserializeObject[T] (String value, Newtonsoft.Json.JsonSerializerSettings settings) 
  at Newtonsoft.Json.JsonConvert.DeserializeObject[T] (String value) 
  at MinecraftModule.SleepServer.SleepClient.GetServerInfo () 
[05:51:31] [Core Error]           : ArgumentException
[05:51:31] [Logger Error]         : [1] (ArgumentException) : Could not cast or convert from System.String to MinecraftModule.SleepServer.ServerDescription.
[05:51:31] [Core Error]           :   at Newtonsoft.Json.Utilities.ConvertUtils.EnsureTypeAssignable (Object value, Type initialType, Type targetType) 
  at Newtonsoft.Json.Utilities.ConvertUtils.ConvertOrCast (Object initialValue, Globalization.CultureInfo culture, Type targetType) 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType (Newtonsoft.Json.JsonReader reader, Object value, Globalization.CultureInfo culture, Newtonsoft.Json.Serialization.JsonContract contract, Type targetType) 
[05:51:31] [Minecraft Warning]    : Unable to get protocol version. Sleep mode will be unavailable.
[05:51:49] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 4380ms or 87 ticks behind
[05:52:00] [Server thread/INFO]: Unknown or incomplete command, see below for error
[05:52:00] [Server thread/INFO]: tps<--[HERE]
[05:55:51] [Logger Activity]      : Authentication attempt for user dylan from 127.0.0.1
[05:55:53] [Core Activity]        : Authentication success
[05:55:53] [Logger Warning]       : Slow method invocation: Login took 2231ms to complete.
[05:55:53] [Logger Warning]       : Slow response: Core.Login took 2231ms to complete.
[05:56:23] [API:dylan Activity]   : Sleeping the application.

Reproduction

  1. Spin up a fresh Minecraft 1.20.4 instance (happens regardless of the server type in use)
  2. Start the server
  3. Attempt to put it to sleep

Verified on the forum by a couple other users

spider-one commented 10 months ago

This also came up with LazyMC which is solely focused on putting empty servers to sleep. Seems like the way Minecraft servers report status has changed for 1.20.4 and as such the status is not being recognized. Some details that may help are here relevant lazymc issue post. This issue sent me on the hunt for an improved solution and I landed on AMP. Hopefully we see this sorted for 1.20.4 at some point, server sleep seems to be a great feature for AMP.

kiloforce commented 10 months ago

Hopeful that this gets fixed. We used to be able to have a lot more instances running on the same server, and the instances we weren't playing on would fall asleep. Different worlds with different play styles (creative, destructive, survival, etc).

IceOfWraith commented 10 months ago

This is fixed in the next release. Currently available in the Preview build.

kiloforce commented 10 months ago

Excellent