Eternal Starlight

Eternal Starlight

5M Downloads

Chunk generation in Eternal Starlight dimension completely freezes server sooner or later

Appulcake opened this issue ยท 3 comments

commented

I'm hosting a modpack server (FTB Evolution) and since world gen can be slow and intensive, I like to pregenerate a whole area in every dimension so that when players explore around they have all that without triggering world gen. This is where I ran into an issue on this mod, and since then I've reproduced the issue with various methods of chunk generations (Chunk-Pregenerator mod, Chunky mod, built in Neoforge generate command), on a new clean Neoforge server set up that is created just for this test purpose (using Neoforge 21.1.187 for MC 1.21.1, issue was also present on various other NeoForge versions like 21.1.172) and only added this mod (eternalstarlight-0.4.3+1.21.1+neoforge) when trying with Neoforge generate, or also chunky/chunk-pregenerator mod when testing it with those.

When setting up a generation command it'll start generating chunks in the starlight dimension, but unlike any other dimensions, sooner or later the entire server will freeze. Many other dimensions (included from other mods) have successfully generated tens of thousands of radius over course of a week without such an issue. This can hit within minutes of the command starting on a fresh world without even any existing starlight dimension chunks yet, or it can even get to finishing over 3500 block radius of chunks before that happens.

Worryingly, I tried to recreate this by generating chunk as a user on the server instead of a pregeneration method, by just flying around at very high speeds in one direction with an auto-flight macro, I got to around 6000 blocks from center when the exact same server frozen behaviour happened.

With a freeze, that means the java.exe server process' CPU usage drops down to 0%, completely no activity. The console is entirely unresponsive, if Spark is running on server it'll occasionally spit out a "Timed out waiting for world statistics" which happens when the server is so overloaded it doesn't respond, or is stuck doing nothing. This means there's no console, latest, or debug log output whatsoever. There's no entries in any logs before this out of the ordinary, no entries for minutes before this suddenly happens.

I could reproduce this issue on two different PCs (one with a Ryzen 3700X and one with a 7950X3D), overall different platforms, except for similarities in using Win10 and both using GraalVM 21 as JVM.
Note that I haven't tried to reproduce any of this in single player internal server, as I'm only interested on how it works when hosted on a dedicated server in one way or another.

The only way for any crash report or log to be produced is to have a max-tick-time set (like say the default 60000) so that when it hangs, the watchdog thread kills the server. With this set to -1, the server seemingly never recovers (at least, it hasn't once I tried waiting for it for over 24 hours).

Here's the logs from a test try where I had the max tick time turned on to 60k so it gets killed and logs get produced:
crash-2025-07-06_19.36.23-server.txt
latest.log
debug.log

commented

More info from some testing done:
It seems the issue is related to Stranghouls near Stranghoul Den structures. Most of the time when generating chunks with them it's fine, however, every now and then something goes wrong there that stalls the entire world ticking thread forever.

Couple jstack outputs from such hung threads, they all have these common in one stuck thread

at cn.leolezury.eternalstarlight.common.entity.living.monster.Stranghoul.setEquipmentsOnGrownUp([email protected]+1.21.1+neoforge/Stranghoul.java:194)
at cn.leolezury.eternalstarlight.common.world.gen.structure.StranghoulDenStructure.afterPlace([email protected]+1.21.1+neoforge/StranghoulDenStructure.java:72)

jstack_out1.txt
jstack_out2.txt
jstack_out3.txt
jstack_out4.txt

I found this pretty easy to reproduce on a seed where such a structure generates pretty close to spawn, on seed world 8541861843230332350 where in the Starlight dimension around roughly 300, -300 there's such a structure so a pregen of ~600-800 or so blocks radius can already run into this every now and then.

It also seems like disabling stranghoul spawn in eternal_starlight.json fixes the issue, after doing that I've had tens of batches of retries generating over this problematic area without issue (where before it'd run into an issue about 1 in 4-8 of the tries), which might be a workaround for now for pregenerating the world and then re-enabling after.

commented

Sorry for the late reply! I'm busy with school recently. Thanks for the detailed report and I've (probably) fixed it in the latest commit. I'll do some further tests before closing the issue.

commented

Hey thank you and no worries! I'm glad it helped pinpoint the issue. I could also finish the pregen (over 24+ hours) fine with stranghoul spawn turned off, no other issues in the many millions of chunks.

I used a test setup of 8 servers looping through pregenerating this seed of a world where within ~4k chunks there's a den so it'd possibly run into this issue quickly. After successfully completing generating just enough to cover that den it'd restart server, delete the starlight dimension and start over. This would pretty much run into at least one instance stalling sometimes within mere minutes, but even just generating one world (with random seed) at a time normally would usually stall within max couple hours (someone in Chunky discord had a similar timeframe reproducing it).

I've dropped in your latest commit to this setup with cleared mod configs right as I got notified of your reply. It's now been running for over 6 hours and all 8 instances are still running fine millions of chunks in. Before they'd have a hard time making it much over 100k, so this seems quite likely to have fixed it!

I'll let them run for at least a day or so for more data and let you know if anything changed, just in case.