EnigmaticaModpacks / Enigmatica2Expert

The official repository and issue-tracker for the modpack Enigmatica 2: Expert for Minecraft 1.12.2
https://www.curseforge.com/minecraft/modpacks/enigmatica2expert
Other
140 stars 127 forks source link

Constant Chunk Loading/Unloading #703

Closed scarfkitten closed 5 years ago

scarfkitten commented 5 years ago

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

scarfkitten commented 5 years ago

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.

NielsPilgaard commented 5 years ago

Oh boy, I have a bad feeling about this issue :P

NielsPilgaard commented 5 years ago

Alright, I have a possible solution. Would you be willing to test it out? I changed two Forge configs: 1) Make sure chunks cannot (should not) be rapidly unloaded-then-loaded 2) 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

ghost commented 5 years ago

This issue was moved by NillerMedDild to NillerMedDild/enigmatica2#294.

ghost commented 5 years ago

This issue was moved by NillerMedDild to NillerMedDild/enigmatica2expertskyblock#367.

scarfkitten commented 5 years ago

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.

NielsPilgaard commented 5 years ago

It has indeed, so I hope it helps :P

scarfkitten commented 5 years ago

Well, good news then! Seems like whatever fixes you've made work. I haven't had the issue since updating to 1.54.

NielsPilgaard commented 5 years ago

Awesome!

Isolol commented 5 years ago

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?

NielsPilgaard commented 5 years ago

I thought it was fixed :/ Are you getting similar console messages?

Isolol commented 5 years ago

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

Gist
logwithoutstartup.txt
GitHub Gist: instantly share code, notes, and snippets.
Gist
logwithstartup.txt
GitHub Gist: instantly share code, notes, and snippets.
Isolol commented 5 years ago

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.

NielsPilgaard commented 5 years ago

Which dimension was his chunkloaded chunks in?

Isolol commented 5 years ago

Overworld dim 0, we will be back to testing here in a few. I’m isolol on your discord if needed.


From: Niels Pilgaard Grøndahl notifications@github.com Sent: Tuesday, February 5, 2019 12:00 PM To: NillerMedDild/Enigmatica2Expert Cc: Dustin; Comment Subject: Re: [NillerMedDild/Enigmatica2Expert] Constant Chunk Loading/Unloading (#703)

Which dimension was his chunkloaded chunks in?

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/NillerMedDild/Enigmatica2Expert/issues/703#issuecomment-460717508, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AFUEa7Xw1eNaPcyx0QGoVfbVE_qpbbqfks5vKbjFgaJpZM4aTbmQ.

NielsPilgaard commented 5 years ago

Say, can you replicate it without the mod Unloader?

Isolol commented 5 years ago

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.

NielsPilgaard commented 5 years ago

Damn, nicely done!

Isolol commented 5 years ago

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:

Recurring chunks in the load/unload process:

NielsPilgaard commented 5 years ago

Did you pregen your world with Chunk Pregenerator? If yes, in which update did you pregen, roughly? No worries if you can't remember.

Isolol commented 5 years ago

We did pregen the world, we pre-gened prior to v1.51, I would say in either 1.48 or 1.49

NielsPilgaard commented 5 years ago

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

Isolol commented 5 years ago

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 😄

Isolol commented 5 years ago

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:

Got it to completely quit happening by just clearing the 3x3 chunks there and relocating his base.

NielsPilgaard commented 5 years ago

Nicely done!

Isolol commented 5 years ago

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.

NielsPilgaard commented 5 years ago

Wow, that is insane. Great catch! That'll make for a good loading screen tip.

DaedalusGame commented 5 years ago

https://github.com/capnkirok/animaniamod/blob/1.12/src/main/java/com/animania/common/entities/generic/ai/GenericAISearchBlock.java#L52 hmmm

GitHub
capnkirok/animaniamod
Animania Mod. Contribute to capnkirok/animaniamod development by creating an account on GitHub.
HellFirePvP commented 5 years ago

I rather think that it's these things:

mikewk commented 5 years ago

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:

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.

NielsPilgaard commented 5 years ago

The bug where entities would TP back to their capture point was from RandomPatches, I guess the fix could've started this issue.

mikewk commented 5 years ago

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.

james commented 4 years ago

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.