Startup Issue with Minecraft - Sleep Function hanging on Forge Minecraft 1.21

System Information

Field Value
Operating System Windows - Windows 11 Pro on x86_64
Product AMP ‘Callisto’ v2.5.1.0 (Mainline)
Virtualization None
Application Minecraft
Module MinecraftModule
Running in Container No
Current State PreparingForSleep

Problem Description

Issue

Hello there!
I have noticed this issue on my Minecraft 1.21 Forge server.

Issue:
Roughly every other time the ‘Sleep’ function is initiated, it hangs in a ‘preparing to sleep’ mode which effectively kills the server and forces me to shut down the entire ‘instance’ of the minecraft server in order to bring it back up.
When the server comes back up, often times because of my current settings, it will auto-sleep. When this occurs during startup (if it occurs) it has been seen to function properly. But for some reason when it happens again, or soon after, the next sleep mode pushed will likely bring the server down once again, requiring more manual intervention. What is expected is we can simply ping the ip under port it is listening for (25565) or see someone connect before it begins starting up the server again. But for some reason, this only works every other time. The issue is with the server Starting up from Sleep Mode not being initiated fully, again this effectively ends the server and requires someone to end the whole minecraft ‘instance’, instead of what is expected. Comes back up without issue though!

What has been done?:
I checked the locale settings and the Unicode UTF-8 setting box is turned off. I clicked off my firewalls and antivirus just to test and see if that made any difference to no avail. Updated Forge to its latest version but that changed nothing. Looking at the logs, it would appear there is a listener being killed which is not coming up. If I can, I will add the server console output to this post so you can see what I do.

Ask:
Does anyone know what I could possibly do to make this process run without needing manual intervening?

Reproduction Steps

  • Wait for the auto sleep function or manually sleep using the ‘Sleep’ Button
  • Expected Result: Sleep mode activates properly, and server falls into a low resource listening state on both 25565 ports
  • What happenes: Sleep function works as expected almost exactly every other time. This can be manually reproduced or will happen with the auto-sleep function all the same

EDIT**
Here is the console output when the issue occurs:

08:44:00
Stopping the server
Stopping server
Saving players
Saving worlds
Saving chunks for level 'ServerLevel[KingdomOfBool]'/minecraft:overworld
Saving chunks for level 'ServerLevel[KingdomOfBool]'/minecraft:the_nether
Saving chunks for level 'ServerLevel[KingdomOfBool]'/minecraft:the_end
ThreadedAnvilChunkStorage (KingdomOfBool): All chunks are saved
ThreadedAnvilChunkStorage (DIM-1): All chunks are saved
ThreadedAnvilChunkStorage (DIM1): All chunks are saved
ThreadedAnvilChunkStorage: All dimensions are saved
Thread Query Listener stopped

Also, as an UPDATE:
As noted above, the state hangs in ‘Preparing to Sleep’, never activating the listener, this is why I assumed it was security related but even with all that off the automation is failing.

Sleep mode doesn’t work with Forge due to the long startup times and some changes to some protocol info.

Thanks for the reply. At least shows potential for a workaround.
Wondering if it can be altered manually given it has proven it CAN work. Just not 100% accurately for some reason or another.

99% of the time it just won’t work, it’ll stall on preparing to sleep, etc. (which is why it isn’t supported)
Sleep mode is not actually putting the server process to sleep. It completely stops the server and waits for connections before starting the server again.

I do agree it would be nice for low-usercount modded servers since they take up a chunk of resources, but it’s just not viable at the moment.
However there are discord bots that can start/stop AMP servers:
https://discourse.cubecoders.com/t/3rd-party-amp-plugins-and-bots-list/2231

You are a badass!
(and yes I know it simply shuts the server down and listens, though sad we can not slightly alter this so we can enable the sleep function).

Going to be adding a discord bot for sure. Thanks again!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.