Ivorforce / RecurrentComplex

Structure mod for Minecraft
MIT License
53 stars 40 forks source link

Big structures (including decoration) can cause chained chunk generation, resulting in a stack overflow #155

Open kreezxil opened 7 years ago

kreezxil commented 7 years ago

got this huge stack trace while pregenerating blocks using sponge

stack trace: https://gist.github.com/ProsperCraft/33f5c1b2db0253a7919a895f18a8f603

there are few other mods indicated in this trace, but yours is the last one in the trace before the server failed. We're trying some other scenarios to get a reliable crash with better logs.

So yeah it might be another mod doing but thought you might want the headsup before we really pin it down as to which is doing it.

ProsperCraft commented 7 years ago

errorereport.zip

That stacktrace is from my server, it didn't push it to the logs, but I have attached the logs for your entertainment.

ProsperCraft commented 7 years ago

This might help- This just occurred while generating the overworld but didn't overflow.

https://gist.github.com/ProsperCraft/e24d775e303611d52c0db2e7928dc8b3

ProsperCraft commented 7 years ago

One thing that bears mentioning, is that this isn't a crash with a crash report, its a threadlock, the only way to recover is kill -9 the process and start it back up.

ProsperCraft commented 7 years ago

Sponge is off the hook- reproduced with forge only- https://gist.github.com/ProsperCraft/08030438766e74fcb19598f187b8025e

I quit copying it from console after 600 lines because I had to get the server back online.

Ivorforce commented 7 years ago

This seems to be an unfortunate chained chunk generation issue.

In short, if structures try to generate or test blocks outside the chunk designated to generate currently, it can cause neighboring chunks to generate as well. If that happens too often, this happens.

Any mod included in the crash log is part of the problem. You can safely submit it to all of them.

For my part, I plan to address this further in the future, but for now I have settled on reducing the issue by generating big structures only few and far between, so that the issue is rare. This problem in particular is caused, I'm pretty sure, by JungleTreeHuge and JungleTreeHuge1 (since they are larger than a chunk). You can disable them (or just make them rarer) by editing the spawnTweaks config option.

If you can get the other mods to fix their part, however, you should be able to activate them again in the future.

@ProsperCraft The other crash is unrelated. I have wrapped the issue in a try/catch so that it doesn't crash anymore and simply logs an error for now. I'm unsure as to what the exact issue is, but as soon as https://github.com/MinecraftForge/MinecraftForge/pull/3318 is implemented (surely it will happen soon?), it will be fixed either way.

Edit: Oh, and I'm leaving the issue open for future reference for now, until it's safe to say it's no longer very relevant.

ProsperCraft commented 7 years ago

We just threadlocked for a good 5 minutes then it recovered, here is the warmroast if it helps.

https://gyazo.com/ad2109599d7a85a9d7e4628c14a1bb2f

Note that this happened while config was still set at S:structureSpawnChance=0

mezz commented 7 years ago

In Forge 1.11.2 - 13.20.0.2258 there is a new detection and log for worldgen features that load new chunks and cause more worldgen.

Based on the new log, this issue might be occasionally caused by smaller Recurrent Complex worldgen features too:

[reccomplex/]: Generated structure 'BirchTree1' in StructureBoundingBox{x0=-87, y0=86, z0=262, x1=-80, y1=102, z1=268} [FML/]: Recurrent Complex loaded a new chunk (-5, 17 Dimension: 0) during chunk population, causing cascading worldgen lag. Please report this to the mod's issue tracker. This log can be disabled in the Forge config. [reccomplex/]: Generated structure 'OakTree' in StructureBoundingBox{x0=-66, y0=80, z0=280, x1=-55, y1=94, z1=292}

For small worldgen, I wrote a post about what I learned here. I assume you have a lot more worldgen experience than I do but I'm still leaving this here in the hopes that it's useful or you have corrections.

For large features, maybe you can use a system like the vanilla Ocean monument? It keeps track of where the structure should be placed, and only creates the portions in chunks that are loaded.

Ivorforce commented 7 years ago

Update: Since 1.4.4, this will occur only with structures size 16x16 and up. There was a shift problem with some structures left.

I will soon move decoration generation (i.e. trees) to chunk-partial generation, and restrict placer tests to blocks actually relevant to placement (i.e. trunks).

A downside to this will be trees generating into nearby terrain sometimes, since they won't be able to consider terrain in neighboring chunks for cancellation. I will look into ways to solve this though.

DrCo commented 5 years ago

I experienced the errors similar to [Server thread/WARN] [FML]: Recurrent Complex loaded a new chunk (81, -80 Dimension: 0) during chunk population, causing cascading worldgen lag. Please report this to the mod's issue tracker. This log can be disabled in the Forge config.

Offsetting chunks may help: https://www.reddit.com/r/feedthebeast/comments/5x0twz/investigating_extreme_worldgen_lag/

Martmists-GH commented 5 years ago

It seems a recent forge update is a partial cause; The generation now happens at an offset from chunk start it seems? (citation needed), and roguelike dungeons is also affected, having the exact same issue.

BTK7 commented 4 years ago

Tryna set up RLCraft server (MC Version 1.12.2 with newest forge release for such), are people having this problem on newer versions of Forge?

wortelus commented 4 years ago

I am having extreme problems with this issue. The recurrent complex is the one causing them. Has there been any kind of fix?

mint27 commented 4 years ago

I have the same issue with RL Craft. Here is a bit of the "latest.log" file.

[21:11:50] [Server thread/WARN] [FML]: Please report this to the mod's issue tracker. This log can be disabled in the Forge config. [21:11:51] [Server thread/WARN] [FML]: Recurrent Complex loaded a new chunk [27, 31] in dimension 0 (overworld) while populating chunk [28, 33], causing cascading worldgen lag. [21:11:51] [Server thread/WARN] [FML]: Please report this to the mod's issue tracker. This log can be disabled in the Forge config. [21:11:51] [Server thread/WARN] [FML]: Recurrent Complex loaded a new chunk [27, 33] in dimension 0 (overworld) while populating chunk [29, 34], causing cascading worldgen lag. [21:11:51] [Server thread/WARN] [FML]: Please report this to the mod's issue tracker. This log can be disabled in the Forge config. [21:11:52] [Server thread/WARN] [FML]: Recurrent Complex loaded a new chunk [29, 33] in dimension 0 (overworld) while populating chunk [29, 35], causing cascading worldgen lag. [21:11:52] [Server thread/WARN] [FML]: Please report this to the mod's issue tracker. This log can be disabled in the Forge config. [21:11:52] [Server Watchdog/FATAL] [net.minecraft.server.dedicated.ServerHangWatchdog]: A single server tick took 60,00 seconds (should be max 0,05) [21:11:52] [Server Watchdog/FATAL] [net.minecraft.server.dedicated.ServerHangWatchdog]: Considering it to be crashed, server will forcibly shutdown. [21:11:52] [Server Watchdog/ERROR] [net.minecraft.server.dedicated.ServerHangWatchdog]: This crash report has been saved to: E:\Games\Server MC.\crash-reports\crash-2020-05-01_21.11.52-server.txt [21:11:52] [Server Shutdown Thread/INFO] [net.minecraft.server.MinecraftServer]: Stopping server [21:11:52] [Server Shutdown Thread/INFO] [net.minecraft.server.MinecraftServer]: Saving players

mint27 commented 4 years ago

It seems a recent forge update is a partial cause; The generation now happens at an offset from chunk start it seems? (citation needed), and roguelike dungeons is also affected, having the exact same issue.

It's not because of a recent forge update. You said that on Jun 2019 this post is from Jan 2017.

Macleykun commented 2 years ago

Hey @Ivorforce how is it going with looking to fix structures 16x16 and up related to this issue?

Ivorforce commented 2 months ago

Update: There's now a new article to avoid cascading chunk generation on the recurrent complex wiki: https://github.com/NoMoreUsernames999/Recurrent-Complex-Wiki/wiki/Avoiding-cascading-chunk-generation

One mentioned feature avoidPlacerChunkGeneration is available from Recurrent Complex 1.4.8.6 forwards.

mezz commented 2 months ago

There are some impressive solutions to the problem here, thanks!