Conflict with other mods during a world unload, potential re-order issue?
TheFlash787 opened this issue ยท 1 comments
Overview
Hi there! I'm using Infiniverse for the provisioning of dynamic worlds, and these worlds often contain modded data from other mods, this example shows Integrated Dynamics blocks.
We've had issues recently where the server will crash when a world is unloaded, and I've attached a pastebin of the issue: https://pastebin.com/qGcQp6u5
Now particularly, what I expect is happening is that:
- I request the world to be marked for unregistration at the next tick.
- At the next tick, the world is then unregistered.
- During this same tick, other mods are trying to tick their blocks, but the world is no longer loaded; and as this is unhandled, it crashes the server.
I looked at the code, where the unregistration is fairly straight forward, handled at the end of a tick.
@SubscribeEvent
public static void onServerTick(final ServerTickEvent event)
{
if (event.phase == TickEvent.Phase.END)
{
MinecraftServer server = ServerLifecycleHooks.getCurrentServer();
if (server != null)
{
DimensionManager.INSTANCE.unregisterScheduledDimensions(server);
}
}
Would this be solvable by having the priority set on this event to run last, after all other event listeners have fired and all other tickable blocks have finished ticking?
Interested in hearing your thoughts!
Hi, I am using the Code as well. We ran into crashes with semi-loaded Chunks that are kept even after unloading the dimension. See AppliedEnergistics/Applied-Energistics-2#7621.
In this Issue I linked a crash report, where you can see that for example AE2 causes a crash since it invalidated the network after the Unload Event and a Forge Energy Provider(Flux Networks, Pipez, ...) then ticks in the next cycle even tough the World got unloaded.
This is caused by Mods using the getBlockState
or setChanged
Functions since these create 1-tick chunk tickets. So to completely fix it we need to block ChunkTickets of the dimension that gets unloaded.