Applied Energistics 2

Applied Energistics 2

160M Downloads

Active Networks keep Chunks semi-loaded

MojangPlsFix opened this issue ยท 5 comments

commented

Describe the bug

Having any active Network in a dimension leads to some leaking ChunkHolders, that never really unload. Even when leaving the world with no ChunkLoaders. The chunk itself is unloaded, but the block is still ticking.

Why is this a problem?

Our server uses a custom mod, that adds dynamic worlds (functionally like Commoble/infiniverse or NucleoidMC/fantasy). Players can have their dimension to play in. If they leave the server, then the world gets unloaded.

These ChunkHolders are not getting unloaded which leads to waiting for the world to have no loaded chunks infinitely or force unloading them. If we choose the latter we can run into some trouble.
For example, ForgeEnergy Provider still ticks to the network and adds power. AE2 invalidates the Network on WorldUnload, since the block itself is still loaded we get an exception when AE2 is trying to get the Grid. (See linked Crashlog)

Note:
My testing instance is the latest version of NeoForge(happens on Forge too) 1.20.1 with 3 Mods:

  • AE2 (latest)
  • FluxNetworks (latest)
  • My Dynamic World Mod

The "leak" still happens without the custom Mod. I just used the unload functionality to create this bug. This mod is almost completely comparable to the mods mentioned above with an added Ebean DB Layer.
The setup to crash the server on unload is a Network with a FluxPlug or any other Energy Device:
image

How to reproduce the bug

  1. Place an arbitrary AE2 Network. For example a dense cell+controller:
    image
  2. Leave World
  3. Obtain Loaded ChunkHolders of dimension via ServerChunkCache.getLoadedChunksCount()/ChunkMap.size. I use a command that just outputs this value and shows me my current Level.
    image

Expected behavior

If a player is in the dimension we should get some loaded ChunkHolders via ChunkMap.size() and if the world is empty we get 0.
image

Additional details

Our 1.19.2 servers and below work fine and don't have this issue.
I can provide an dumbed down version of the Mod as well or if really needed access to the mod itself (preferably only to the AE2 Dev Team)

Which minecraft version are you using?

1.20

On which mod loaders does it happen?

Forge

Crash log

https://pastebin.com/UgHFiDwP

commented

Interesting. Assuming that flux networks is sending energy to unloaded chunks, wouldn't this be a bug with flux networks rather than AE2?

commented

Interesting. Assuming that flux networks is sending energy to unloaded chunks, wouldn't this be a bug with flux networks rather than AE2?

This happens with any EnergyProvider. I have some crashes with Pipez. (Which I can sent later)

The Main Problem is the "semi-chunkloading" by the ae2 Network.

commented

Very weird. I'd have thought remove() on the BE immedaitely prevents further ticking through the TickService. How is that happening?

But okay, I think we're getting a clearer picture of what is going on. We should invest some into into finding a way of automatically testing this if that is at all possible...

commented

You are right, there is some accidental chunk loading :)

image

commented

Was a really nasty issue, thanks. Here is a fix: #7623.