Constant Chunk Loading/Unloading
scarfkitten opened this issue Β· 33 comments
Thank you for helping us improve.
Please follow the issue template, and do not delete any part of it.
Failure to comply will result in the issue being closed.
Issue Description
There seems to be a bad interaction between Thaumcraft trying to load the aura for chunks within the Twilight Forest, and those chunks being immediately unloaded, only to be reloaded the next tick. This causes immense server lag and bleeds out memory at an alarming rate. If left over night, the server eventually runs out of memory and crashes. Usually takes ~6 hours depending on the level of user usage.
This only began when I entered the twilight forest, making me think that it might be on TF's end.
It's worth noting that I have 3GBmin and 6GBmax of memory dedicated to the client
Modpack version (Do not use "latest")
1.53 - Nutrition Mod disabled, no other changes. Laggoggles mod added to diagnose the problem when it first began - problem began before any additions to the pack.
Logs
First log - demonstrates the chunk loading lag.
https://gist.github.com/scarfkitten/e5c5ef5c12cd5008e9162e115d21d186
Second log - demonstrates java running out of memory due to aforementioned chunk loading lag. Please excuse the truncated log; MultiMC decided to delete a huge chunk of the loading log when I ran lag goggles. Relevant information at the end.
https://gist.github.com/scarfkitten/aa9cb9c873d9ac4b467bea2ec6479620
Screenshots
Not relevant.
Additional context
N/A
Oh - and for a temporary, albiet less than ideal fix, you can just wholesale delete the dim7 folder which contains twilight forest's world data.
Alright, I have a possible solution. Would you be willing to test it out?
I changed two Forge configs:
- Make sure chunks cannot (should not) be rapidly unloaded-then-loaded
- Keep a cache of recently loaded chunks
You will need to change config/forge.cfg
line 80 to I:dimensionUnloadQueueDelay=100
and config/forgeChunkLoading.cfg
line 26 to I:dormantChunkCacheSize=64
This issue was moved by NillerMedDild to NillerMedDild/enigmatica2#294.
This issue was moved by NillerMedDild to NillerMedDild/enigmatica2expertskyblock#367.
Ah, sorry! Just noticed that message when I checked the changelog for 1.54. I'm guessing the fix has been implemented in 1.54? I'll happily give it a go and see what comes of it.
Well, good news then! Seems like whatever fixes you've made work. I haven't had the issue since updating to 1.54.
This happens about every 45s, we never had it happen before. I can upload the log from when it started as well if you'd like. Also I launch with Xms 4gb Xmx 8gb
[01:38:38] [Server thread/INFO] [STDOUT]: [biomesoplenty.common.world.BiomeProviderBOP::61]: settings for world:
[01:38:38] [Server thread/INFO] [STDOUT]: [biomesoplenty.common.world.BiomeProviderBOP:initialLandAndSeaLayer:93]: Setting up landmass VANILLA
[01:38:38] [Server thread/INFO] [FML]: Loading dimension 7 (Poetry Corner) (net.minecraft.server.dedicated.DedicatedServer@261a4703)
[01:38:38] [Server thread/INFO] [THAUMCRAFT]: Creating aura cache for world 7
[01:38:38] [Server thread/INFO] [FML]: Loading dimension 114 (Poetry Corner) (net.minecraft.server.dedicated.DedicatedServer@261a4703)
[01:38:38] [Server thread/INFO] [THAUMCRAFT]: Creating aura cache for world 114
[01:38:38] [Thread-252/INFO] [THAUMCRAFT]: Starting aura thread for dim 7
[01:38:38] [Thread-253/INFO] [THAUMCRAFT]: Starting aura thread for dim 114
[01:38:43] [Server thread/INFO] [THAUMCRAFT]: Removing aura cache for world 7
[01:38:43] [Server thread/INFO] [FML]: Unloading dimension 7
[01:38:43] [Server thread/INFO] [THAUMCRAFT]: Removing aura cache for world 114
[01:38:43] [Server thread/INFO] [FML]: Unloading dimension 114
[01:38:44] [Thread-252/INFO] [THAUMCRAFT]: Stopping aura thread for dim 7
[01:38:44] [Thread-253/INFO] [THAUMCRAFT]: Stopping aura thread for dim 114
[01:38:50] [Server thread/INFO] [FML]: Loading dimension 114 (Poetry Corner) (net.minecraft.server.dedicated.DedicatedServer@261a4703)
[01:38:50] [Server thread/INFO] [THAUMCRAFT]: Creating aura cache for world 114
[01:38:50] [Thread-254/INFO] [THAUMCRAFT]: Starting aura thread for dim 114
[01:38:55] [Server thread/INFO] [THAUMCRAFT]: Removing aura cache for world 114
[01:38:55] [Server thread/INFO] [FML]: Unloading dimension 114
[01:38:56] [Thread-254/INFO] [THAUMCRAFT]: Stopping aura thread for dim 114
Log without startup: https://gist.github.com/Isolol/32f00576488a7cc5d7d283a5c7a55d00
Full log: https://gist.github.com/Isolol/e98edcc68d4f9b999db7ffe244ac7bfc
Log from when it started: https://gist.github.com/Isolol/278f20deb75dc25abea81fc2b8655d39
Used Sampler to get this when it loads 114: https://gist.github.com/Isolol/f24f80b7224b501ec0704505de7c4b99
GitHub Gist: instantly share code, notes, and snippets.
GitHub Gist: instantly share code, notes, and snippets.
Not really sure what is causing it but our world started doing this in v1.51, we updated to 1.54 and it still persists on dim 7 and 114. After about 6 hours the tick skips start getting fairly bad. Anything I can do on my end to help track this down?
Update: Doing some toying around with the server/world I was able to determine that it has no bearing if you completely delete dims 7 (Twilight Forest) and 114 (Stella). Deleting their world data had no effect on the dims being loaded in this instance.
We will continue to poke around and see if we can determine the exact cause.
Edit: We have isolated it to a certain person's base, as the loading/unloading stops when someone is within chunk loading radius of his base. Going to continue testing.
Edit2: We can't seem to figure out what EXACTLY is causing it, but it seems to be related to FTB Chunkloading, as when we removed said person's chunkloading, it stopped entirely. I'm in the process of moving stuff to another machine on the network to spin up and start poking at machines/ect.
It continues without the mod Unloader
. However, we seem to have narrowed it down to a single chunk causing it when chunkloaded. I am currently dissecting what is causing it.
Both of us are backend devs, stuff like this interests us π. Would you like me to submit a new issue, or continue posting to this one?
Things we've worked out so far:
- It's related to chunkloading, we have several chunks that cause a cascade upon each other
- It's only happening in a single person's base who is much further ahead of everyone
- It doesn't happen when a physical character is at his base
- Source chunk changes between 4-5 chunks, but seems to be the same chunks
- Doesn't seem related to a specific chunk-loading source
Recurring chunks in the load/unload process:
- 59/-16 - AS lights, explored, corner of mob farm
- 56/-14 - torches, explored, nothing
- 55/-19 - AS lights everywhere, explored, solar gen, trees
- 54/-17 - torches, explored, nothing
- 55/-16 - distillation center, oil, ect
- 57/-20 - TF/Thaum trees (broke - no effect)
- 56/-20 - edge of cow pen, explored, torches, nothing
- 55/-15 - Torches, explored, nothing
Did you pregen your world with Chunk Pregenerator? If yes, in which update did you pregen, roughly? No worries if you can't remember.
We did pregen the world, we pre-gened prior to v1.51, I would say in either 1.48 or 1.49
This could be related to an older issue with Thaumcraft/Chunk Pregenerator, where the aura would keep regenerating. It has been fixed, but I don't think servers that already had the issue would've been fixed by it.
But... That doesn't really help :P
Well, we just detonated a DE reactor in his base to see if it was just his base entirely, or if it was just random chunks. Problem disappeared.
Guess I'm going to find out how to fix it π
After some more testing, we determined the cause of the constant loading of dim 114. He brought mooshroms back from stella and put them in his pink slime pen. As far as dim 7, we've narrowed it down to the possibility of fireflies/TF trees being on the surface instead. But we were able to get it to quit happening so much by:
- Clearing the flux in the area with Flux Sponge
- Remove Mooshroms from overworld
- Remove all chunkloading
Got it to completely quit happening by just clearing the 3x3 chunks there and relocating his base.
Wow, that is insane. Great catch! That'll make for a good loading screen tip.
I rather think that it's these things:
-
The entity still having some sort of position-reference cached that tells it to navigate to where it 'used to be' (or close-by there) that is now several hundred or thousand blocks away in this world -> pathfinding into unloaded chunks
-
The entity in the result of loading chunks loads a portal, potentially TF, by accident (which would be likely since TF portals are usually built close-by to a player's base) and then (TF portal being horizontal) something walks across it, be it a zombie, chicken, item-entity, and 'falls through' to then load the TF dimension to spawn the entity there.
Alright, after tons of testing we have finally got the EXACT cause of the problems. Other people may be seeing this and not really noticing much depending on how many mobs they moved.
Mobs from other dimensions (TF and Stella in this instance) were brought to the overworld. Every so often they attempt to "path" back to their original "home" which is causing cascading chunkloading, and eventually loading their home dim. Doesn't seem to happen with vanilla mobs at all, however a chicken brought back from TF caused the cascading issue as well.
This is why when we set off the DE nuke, everything went back to normal.
I was the one working with Isolol to track this down. We had multiple different entities trigger this and they all triggered it after I destroyed the portal to TF. Those entities were:
- Animania Mooshrooms taken from Stella (Dim 114)
- Vanilla Chickens taken from TF (Dim 7)
- TF Bighorn Sheep taken from TF
- Vanilla Cow taken from Philucka (Dim 115)
I think the keys here are that they were taken with the RandomThings Summoning Pendulum and that the dimensions that would get loaded was the one they were taken from. So if the Mooshrooms where in the my base as it loaded and unloaded, Dim 114 would be the dimension loaded/unloaded in the logs.
I think it's clear it's something to do with moving the mobs with the pendulum, not anything to do with TF. I do vaguely remember that in an earlier version of E2E the pendulum didn't work at all because the entity would just teleport back to where you picked it up. May be related?
I guess it's time to stop pretending I was going to avoid getting into the coding side of modded MC.
The bug where entities would TP back to their capture point was from RandomPatches, I guess the fix could've started this issue.
Which now that you mention that reminds me it was the Golden Lasso, which made me compare their code, and found the Golden Lasso sets a dimension tag and Pendulum does not. Phew, done.
This was a really handy thread, thanks for figuring this out! I had a similar issue on my ATM3 Remix server, where a player had brought animals back from the twilight forest using EnderIO's soul vial.
I went around picking each one up and dropping them back down with a Golden Lasso, and that seems to have resolved it! I had a quick look through the source code of Soul Vials and while my knowledge of Minecraft's internals is very thin, it doesn't look to me that it does anything to reset the dimension either, although my confidence in this isn't quite strong enough to try and open a PR on it myself.