Jump to content

Cannot reload singleplayer world because of ongoing internal server transition is in progress


Recommended Posts

Scenario
Enter the singleplayer game, load saved world.
Exit from world into menu.
As soon as menu is available, load world again (another or the same, does not matter).
Game is stuck at "Loading World" message forever.

 

This happens to me very often on modpack "Modern Skyblock 2", but I've seen other people complaining that too:
https://www.reddit.com/r/FeedTheBeastCrashes/comments/753f4q/atm3_loading_world_issue/
From talking with other people, it seems that the problem occurs on big modpacks. Probably - on PC with good specs.

 

Log file (it has some additional log messages that I've injected during debug):
https://github.com/MinecraftForge/MinecraftForge/files/1465625/2017-11-12-4.log

Minecraft Forge in my case is of version 14.23.0.2532.

 

Investigations
As can be seen from the log, the problem is that when I try to load new world, it complaining about server's state:

 

[23:18:15] [Server thread/FATAL]: Fatal errors were detected during the transition from SERVER_STOPPING to SERVER_ABOUT_TO_START (actual SERVER_STOPPED). Loading cannot continue

 

[23:18:15] [Server thread/FATAL]: The ForgeModLoader state engine has become corrupted. Probably, a state was missed by and invalid modification to a base classForgeModLoader depends on. Thi
s is a critical error and not recoverable. Investigate any modifications to base classes outside ofForgeModLoader, especially Optifine, to see if there are fixes available.
[23:18:15] [Server thread/ERROR]: A fatal exception occurred during the server about to start event
java.lang.RuntimeException: The ForgeModLoader state engine is invalid
        at net.minecraftforge.fml.common.LoadController.transition(LoadController.java:193) ~[LoadController.class:?]
        at net.minecraftforge.fml.common.Loader.serverAboutToStart(Loader.java:841) [Loader.class:?]
        at net.minecraftforge.fml.common.FMLCommonHandler.handleServerAboutToStart(FMLCommonHandler.java:290) [FMLCommonHandler.class:?]
        at net.minecraft.server.integrated.IntegratedServer.func_71197_b(IntegratedServer.java:155) [chd.class:?]
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484) [MinecraftServer.class:?]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_25]

 

 I've found out that when exiting from the world, internal server is switching first to SERVER_STOPPING state, and stays in that state after client already exited from world and is able to load world again. But when I'm trying to load the world again, code assumes that server is in an AVAILABLE state, and that causes the unrecoverable error.
As a result, entire game process needs to be relaunched, which usually takes quite a time on big modpacks.

Workaround for the player is to wait for some time between exiting the world and then (re-)loading world. But it's problematic - hard to guess exact timing. To be sure, one has to look in logs and wait for specific log messages that indicate server has stopped (by the way, there's no direct message about that in standard log).
In my situation, it's about 15 seconds of waiting.

 

Further investigations showed that there seems to be a miscommunication between server and client.

Client waits for server to be shut down at
net/minecraft/client/Minecraft.java:2451

                while (!integratedServer.isServerStopped())
                {
                    try
                    {
                        Thread.sleep(10);
                    }
                    catch (InterruptedException ie) {}
                }

net/minecraft/server/MinecraftServer.java:1212

    public boolean isServerStopped()
    {
        return this.serverStopped;
    }

So it just wait for server's property serverStopped to be true.
But:
net/minecraft/server/MinecraftServer.java:575

            try
            {
                this.stopServer();
                this.serverStopped = true;
            }
            catch (Throwable throwable)
            {
                LOGGER.error("Exception stopping the server", throwable);
            }
            finally
            {
                net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStopped();
                this.serverStopped = true;
                this.systemExitNow();
            }

So, handleServerStopped() is executed AFTER this.serverStopped = true
And handleServerStopped is peforming transition of LoadController to SERVER_STOPPED and then AVAILABLE state. So I still think that's a problem in forge.
The mods in this case are only responsible for long transition from SERVER_STOPPING to SERVER_STOPPED.

 

So I suppose the fix is to remove
this.serverStopped = true;
that is directly after
this.stopSever()

 

I will try this patch later, meanwhile I would like to ask devs if I understand it right.

Edited by Stanislav Kupryakhin
Better formatting, minor rephrasing.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.