Multiplayer server worldgen lag
Opened this issue · 4 comments
while generating a chunk, some feature (structure, etc) is too big to fit in that one chunk and needs to generate an adjacent chunk early to finish the structure and this causes server lag that leads to crashes
I would also like to add these structures generate in modded dimensions like the twilight forest
(I will use Dedicated Server language as even in single player, Minecraft is still split into client-side and server-side. A dedicated server is just the server-side, without rendering. In singleplayer, you are running the server and client (rendering) at the same time, so expect worse performance.)
This is going to happen in any kind of structure generation mod: the mod is going to have to request the engine to load chunks that haven't been loaded in already. This is part of cascading world generation lag, and you can reduce it by lowering spawn chances of structures in this mod. Another way to fix it is the upgrade the CPU on/for your server, or use Linux OS for a server instead of Windows OS to reduce overhead and reserve more resources for Minecraft's Server jar.
Your server is not crashing, you are just timing out or it is stalling. Usually caused by an infinite for
loop, or just a lot of code trying to run at once, if you're on a good system. Stalling is a lot more common on older CPU models. Timing out happens because of a network not sensing that the server is receiving an isAlive packet soon enough, so it terminates your connection. Again, this is not a crash. If you are receiving a "crash" with a return to desktop and a crashlog, then that is an actual crash. Otherwise, the server/world not responding is just a stall. Use Sampler to detect a stall, as it will output a stall log with a stacktrace.
The easiest way to fix timing out would be to put this in your JVM args on the server (and to be safe, the client): -Dfml.readTimeout=16048
This ensures that the isAlive packet wait limit is longer and doesn't boot you out too quickly.
Generating structures outside of the Overworld is definitely a bug. That should be made into its own Issue, however.
I plan to rewrite the structure spawning system, as right now, it equates to basically using alot of /setblock commands to spawn structures, I'll be moving it to structure files instead.