
Problem with rebooting empty servers
Pogono opened this issue ยท 25 comments
After rebooting the server with no players on it the values for randomTickSpeed and doFireTick are still paused.
Even after players are back on it.
Logging in and checking the values are:
randomTickSpeed = 0
doFireTick = false
Setting them back to 3 and true and then repeating the procedure gets them paused again.
Managed to repeat the problem with both 1.4.0.1 and 1.4.0.3
I can't reproduce this, but adding some more robust override logic. I suspect that the worlds you are loading are ticking before the world is actually loaded (which is weird). I've tried this on a few different machines and it works fine, so have no idea.
I'll push up an update shortly for you to try. Basically ensure that the world is loaded before attempting to pause the server. And I'll make sure to set the game rules if the override is set on world load to ensure that the settings get set initially correctly.
It only does this when using the GUI. For some reason servers don't shut down properly when not on the command line. I'm not sure the issue. I'll make the override work and be the default for now. I'd recommend always starting and stopping the server via CL if possible, it is the only reliable method for many years now for some reason.
Ok, a fix has been released. This will resolve the issue for now. I"m not sure what to do about the gui not shutting down the server correctly. I only ever use the CL, so I hadn't seen this issue fully. Forge events tend to be a bit buggy. There may already be a report for this. I'll look. In the meanwhile this should now work for you. Thanks for your patience!
Ok, greatly appreciate the feedback. I have tested with the overrides extensively now and that will work 100%. Hopefully it just works, but we'll see.
One other thought I had was that I also often test with a full modpack. Maybe /stop is happening differently with more mods loaded. But I was able to reproduce with the GUI and get it working correctly with the latest. So hopefully this fixes the issue for 1.18.2.
Didn't notice the --nogui flag weren't on by default.
Only use ssh to run the server so I never saw any windows until I tested it on Windows.
I'm a bit to beat to do any test it out right now but it seems like a likely culprit.
Tested ReadyPlayerFun-1.18-1.4.1.3 on the windows and linux test servers and it works fine with and without the GUI.
Is this for 1.18.2? I saw that as well. I thought I resolved it with 1.4.0.3.... Are you by any chance using Global Game Rules?
Let me see if I can reproduce locally. I'm using Linux as well, so not sure what the issue might be. I do know this is an issue, it is just really weird. Once it triggers, it seems to do it every time. I'll update here in a little while.
Yeah I should have provided some more information. My bad.
I haven't run any Global Game Rules mod. If that is a mod.
Forge 40.1.0
Minecraft 1.18.2
Java
java version "17.0.1" 2021-10-19 LTS
Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)
I did some more tests on a new forge server with ReadyPlayerFun-1.18-1.4.0.3 as the only mod.
Made a new Forge instance. Same settings as above. Zero mods added.
Every time I closed the server I used the stop command in the server terminal.
Test one: Reboot of a empty server.
Started the server. Values before I joined it.
[16:12:33] [Server thread/INFO] [readyplayerfun/]: Pausing server onWorldTick at 0, 0
gamerule randomTickSpeed
[16:13:02] [Server thread/INFO] [minecraft/DedicatedServer]: Gamerule randomTickSpeed is currently set to: 0
gamerule doFireTick
[16:13:10] [Server thread/INFO] [minecraft/DedicatedServer]: Gamerule doFireTick is currently set to: false
Joining with forge client with no active mods.
[16:14:21] [Server thread/INFO] [readyplayerfun/]: Unpausing server: onPlayerLogin, 0:01:48 at 0, 0
gamerule doFireTick
[16:14:28] [Server thread/INFO] [minecraft/DedicatedServer]: Gamerule doFireTick is currently set to: true
gamerule randomTickSpeed
[16:14:31] [Server thread/INFO] [minecraft/DedicatedServer]: Gamerule randomTickSpeed is currently set to: 3
leaving server
[16:14:40] [Server thread/INFO] [readyplayerfun/]: Pausing server onPlayerLogout at 396, 396
gamerule randomTickSpeed
[16:14:45] [Server thread/INFO] [minecraft/DedicatedServer]: Gamerule randomTickSpeed is currently set to: 0
gamerule doFireTick
[16:14:48] [Server thread/INFO] [minecraft/DedicatedServer]: Gamerule doFireTick is currently set to: false
stopping and restarting server.
[16:16:18] [Server thread/INFO] [readyplayerfun/]: Pausing server onWorldTick at 396, 396
gamerule doFireTick
[16:16:30] [Server thread/INFO] [minecraft/DedicatedServer]: Gamerule doFireTick is currently set to: false
gamerule randomTickSpeed
[16:16:35] [Server thread/INFO] [minecraft/DedicatedServer]: Gamerule randomTickSpeed is currently set to: 0
join the server after reboot
[16:16:48] [Server thread/INFO] [readyplayerfun/]: Unpausing server: onPlayerLogin, 0:00:29 at 396, 396
gamerule randomTickSpeed
[16:16:59] [Server thread/INFO] [minecraft/DedicatedServer]: Gamerule randomTickSpeed is currently set to: 0
gamerule doFireTick
[16:17:00] [Server thread/INFO] [minecraft/DedicatedServer]: Gamerule doFireTick is currently set to: false
Test two: rebooting active server.
reset the values
gamerule doFireTick true
[16:17:25] [Server thread/INFO] [minecraft/DedicatedServer]: Gamerule doFireTick is now set to: true
gamerule randomTickSpeed 3
[16:17:29] [Server thread/INFO] [minecraft/DedicatedServer]: Gamerule randomTickSpeed is now set to: 3
stopping the server while I'm still on it.
After boot
[16:19:52] [Server thread/INFO] [readyplayerfun/]: Pausing server onWorldTick at 2899, 2899
gamerule doFireTick
[16:20:06] [Server thread/INFO] [minecraft/DedicatedServer]: Gamerule doFireTick is currently set to: false
gamerule randomTickSpeed
[16:20:12] [Server thread/INFO] [minecraft/DedicatedServer]: Gamerule randomTickSpeed is currently set to: 0
After joining
[16:20:33] [Server thread/INFO] [readyplayerfun/]: Unpausing server: onPlayerLogin, 0:00:41 at 2899, 2899
gamerule randomTickSpeed
[16:20:38] [Server thread/INFO] [minecraft/DedicatedServer]: Gamerule randomTickSpeed is currently set to: 0
gamerule doFireTick
[16:20:41] [Server thread/INFO] [minecraft/DedicatedServer]: Gamerule doFireTick is currently set to: false
Test three: joining and leaving the server three times with no reboot of the server
[16:18:25] [Server thread/INFO] [readyplayerfun/]: Unpausing server: onPlayerLogin, 0:00:06 at 1978, 1978
gamerule randomTickSpeed 3
[16:18:29] [Server thread/INFO] [minecraft/DedicatedServer]: Gamerule randomTickSpeed is now set to: 3
gamerule doFireTick true
[16:18:31] [Server thread/INFO] [minecraft/DedicatedServer]: Gamerule doFireTick is now set to: true
My test got slightly out of order.
But it seems that the issue arise every time I reboot the server. No matter if it is active or paused before I stop it.
Perhaps the settings need to be stored in a config file or something that keeps the value over reboots.
Ok, I had the same issue, but I think it is how forge is shutting down. For me, I had dynmap running and it basically has errors on shutdown that caused it so the event couldn't fire. I'm not entirely sure what to do about this. I'm still doing some testing, but if there is another mod throwing errors when stopping the server, it will cause issues with the gamerules :(
That said, I added Dynmap after the world is generated and restart the server and everything works as expected. I think it is probably another mod throwing an error on "stop" and the event to restore the settings isn't firing.
Another note. I updated forge to the latest 4.1.14 and haven't been able to reproduce this.
Still happening for me after updating to 40.1.14. No errors are thrown no after the stop command. It should not be a conflict with another mod as it is the only mod on the test server.
Java should generally act the same on Windows or Linux. But I could test hosting on a Windows machine if you want.
I could also experiment with Dynmap or global GameRule later and see if they affect the problem.
Ok, this was an issue with new servers. The "fix" for this is to disable the mod, start the server. Apply the correct game rules, then restart with the mod. I will push out a fixed version.
The issue is basically that the game data isn't settled and forge fires the event early. I had to put something in to prevent this. Kinda bad, but the event stuff in Forge isn't super reliable at times.
There is also another bad scenario. If using the gamerule command on the server, it will not be preserved unless a player is logged in. I will add some config options to make it so you can override the rules regardless.
Ok, I just released 1.4.1.1 with a fix. This was a weird one .... but here is what you need to know.
You can log in with a player and set the game rules. Then log back out. In the current version things should now work correctly.
Alternatively, you can start the server without the mod. Apply the correct game rules. Restart server with mod. Things will work correctly.
With the new released version, you'll still need to set the game rules properly as stated above if upgrading. If creating a new world, it will work normally.
Also, with the new version, there is a server config that can be leveraged to just completely override the rules manually if desired.
Hope this helps!
Really odd, it usually takes like 5 minutes for a release to get approved. I see it i still stuck in approval queue. I'll post a link here once it is ready.
Ok, it is finally up. https://www.curseforge.com/minecraft/mc-mods/ready-player-fun/files/3780189
Tested with both 1.4.1.1 and 1.4.1.2. Everything works fine until I stop and restart the server.
Afterwards the values stay at 0 and false. Even after I join.
I don't think the values I set in readyplayerfun-server.toml are respected either.
Did you set as the player? Or did you set this from the server console? If setting from the server console in an existing world, it will not store the setting. I'd have to add code to account for that.
Also, try creating a new world, will work fine. This was literally an issue with newly created worlds in 1.18.2 only.
Seems like I can't get it to work
All of these tests were done with:
Forge 1.18.2-40.1.14
ReadyPlayerFun-1.18-1.4.1.2
Starting a new world
got these warnings, seems to be normal when generating new config files
[16:17:13] [Server thread/WARN] [ne.mi.co.ForgeConfigSpec/CORE]: Incorrect key FORCE_GAME_RULES was corrected from null to its default, false.
[16:17:13] [Server thread/WARN] [ne.mi.co.ForgeConfigSpec/CORE]: Incorrect key DO_FIRE_TICK was corrected from null to its default, true.
[16:17:13] [Server thread/WARN] [ne.mi.co.ForgeConfigSpec/CORE]: Incorrect key RANDOM_TICK_SPEED was corrected from null to its default, 3.
They don't appear again on the same world and were absent when I had a config file in defaultconfigs.
First join
[16:18:24] [Server thread/INFO] [minecraft/DedicatedServer]: Frohdude joined the game
[16:18:24] [Server thread/INFO] [readyplayerfun/]: Unpausing server: onPlayerLogin, 0:00:31 at 0, 0
gamerule randomTickSpeed
[16:18:39] [Server thread/INFO] [minecraft/DedicatedServer]: Gamerule randomTickSpeed is currently set to: 3
leaving
[16:18:54] [Server thread/INFO] [readyplayerfun/]: Pausing server onPlayerLogout at 595, 595
gamerule randomTickSpeed
[16:18:57] [Server thread/INFO] [minecraft/DedicatedServer]: Gamerule randomTickSpeed is currently set to: 0
stopping, restarting and joining
[16:20:04] [Server thread/INFO] [readyplayerfun/]: Unpausing server: onPlayerLogin, 0:00:07 at 595, 595
gamerule randomTickSpeed
[16:20:20] [Server thread/INFO] [minecraft/DedicatedServer]: Gamerule randomTickSpeed is currently set to: 0
OPin myself and running the command as a player.
[16:21:59] [Server thread/INFO] [minecraft/DedicatedServer]: [Frohdude: Gamerule randomTickSpeed is now set to: 4]
leaving, rebooting and joining.
[16:23:15] [Server thread/INFO] [readyplayerfun/]: Unpausing server: onPlayerLogin, 0:00:16 at 3166, 3166
gamerule randomTickSpeed
[16:23:20] [Server thread/INFO] [minecraft/DedicatedServer]: Gamerule randomTickSpeed is currently set to: 0
setting FORCE_GAME_RULES = true
booting the server and joining it
[16:25:19] [Server thread/INFO] [readyplayerfun/]: Unpausing server: onPlayerLogin, 0:00:10 at 3747, 3747
gamerule randomTickSpeed
[16:25:33] [Server thread/INFO] [minecraft/DedicatedServer]: Gamerule randomTickSpeed is currently set to: 0
saving the modified settings file to default config and making a new world.
[16:28:55] [Server thread/INFO] [readyplayerfun/]: Unpausing server: onPlayerLogin, 0:00:17 at 0, 0
gamerule randomTickSpeed
[16:28:58] [Server thread/INFO] [minecraft/DedicatedServer]: Gamerule randomTickSpeed is currently set to: 3
rebooting and joining
[16:30:12] [Server thread/INFO] [readyplayerfun/]: Unpausing server: onPlayerLogin, 0:00:03 at 117, 117
gamerule randomTickSpeed
[16:30:21] [Server thread/INFO] [minecraft/DedicatedServer]: Gamerule randomTickSpeed is currently set to: 0
I have noticed the server time some hours of from my local time, but I can't really see how that would cause this.
Gonna give hosting on a windows machine a go later this weekend.
Let me do some more testing. I'm not sure why you are having this issue. I'm running two servers. 1.18.1 and 1.18.2 on linux and both work well. Thanks for sticking with this. It seems like your minecraft server isn't stopping correctly.
Are you using the /stop command to stop the server? Or just killing the java process?
I'm using the stop command.
Did some testing on a windows 11 now. A separate computer, not a VM.
java version "18.0.1.1" 2022-04-22
Java(TM) SE Runtime Environment (build 18.0.1.1+2-6)
Java HotSpot(TM) 64-Bit Server VM (build 18.0.1.1+2-6, mixed mode, sharing)
forge 40.1.19
ReadyPlayerFun-1.18-1.4.1.2 as the only mod.
I got the same behavior. Upon creating a new world the mod works fine.
But after /stop and starting the server again I have to manually fix the gamerules.
Then it breaks on the next reboot.
I did all /stop commands when the server were empty.