Server Hang when trying to spawn entities during worldgen.
marchermans opened this issue ยท 6 comments
Hello,
We had a server hangup during worldgen.
Based on the threaddump it looks like you are looking up the tile entities in an area, this can cause hangups.
at [email protected]/jdk.internal.misc.Unsafe.park(Native Method)
at [email protected]/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:252)
at TRANSFORMER/[email protected]/net.minecraft.util.thread.BlockableEventLoop.m_5667_(BlockableEventLoop.java:146)
at TRANSFORMER/[email protected]/net.minecraft.util.thread.BlockableEventLoop.m_18701_(BlockableEventLoop.java:136)
at TRANSFORMER/[email protected]/net.minecraft.server.level.ServerChunkCache.m_7587_(ServerChunkCache.java:132)
at TRANSFORMER/[email protected]/net.minecraft.world.level.Level.m_6522_(Level.java:170)
at TRANSFORMER/[email protected]/net.minecraft.world.level.LevelReader.m_46819_(LevelReader.java:122)
at TRANSFORMER/[email protected]/net.minecraft.world.level.Level.m_6325_(Level.java:165)
at TRANSFORMER/[email protected]/net.joefoxe.hexerei.util.HexereiUtil.getTileEntitiesAroundPosition(HexereiUtil.java:97)
at TRANSFORMER/[email protected]/net.joefoxe.hexerei.util.HexereiUtil.getAllTileEntityPositionsNearby(HexereiUtil.java:69)
at TRANSFORMER/[email protected]/net.joefoxe.hexerei.events.SageBurningPlateEvent.onEntityJoin(SageBurningPlateEvent.java:56)
at net.minecraftforge.eventbus.ASMEventHandler_880_SageBurningPlateEvent_onEntityJoin_CheckSpawn.invoke(.dynamic)
at MC-BOOTSTRAP/[email protected]/net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85)
at MC-BOOTSTRAP/[email protected]/net.minecraftforge.eventbus.EventBus$$Lambda$4067/0x000000080164cef8.invoke(Unknown Source)
at MC-BOOTSTRAP/[email protected]/net.minecraftforge.eventbus.EventBus.post(EventBus.java:302)
at MC-BOOTSTRAP/[email protected]/net.minecraftforge.eventbus.EventBus.post(EventBus.java:283)
at TRANSFORMER/[email protected]/net.minecraftforge.event.ForgeEventFactory.canEntitySpawn(ForgeEventFactory.java:203)
at TRANSFORMER/[email protected]/net.minecraftforge.common.ForgeHooks.canEntitySpawn(ForgeHooks.java:1076)
at TRANSFORMER/[email protected]/net.minecraft.world.level.NaturalSpawner.m_47038_(NaturalSpawner.java:181)
at TRANSFORMER/[email protected]/net.minecraft.world.level.NaturalSpawner.m_47045_(NaturalSpawner.java:124)
at TRANSFORMER/[email protected]/net.minecraft.world.level.NaturalSpawner.m_47029_(NaturalSpawner.java:114)
at TRANSFORMER/[email protected]/net.minecraft.server.level.ServerChunkCache.m_8490_(ServerChunkCache.java:355)
at TRANSFORMER/[email protected]/net.minecraft.server.level.ServerChunkCache.m_142483_(ServerChunkCache.java:311)
at TRANSFORMER/[email protected]/net.minecraft.server.level.ServerLevel.m_8793_(ServerLevel.java:278)
at TRANSFORMER/[email protected]/net.minecraft.server.MinecraftServer.m_5703_(MinecraftServer.java:868)
at TRANSFORMER/[email protected]/net.minecraft.server.dedicated.DedicatedServer.m_5703_(DedicatedServer.java:328)
at TRANSFORMER/[email protected]/net.minecraft.server.MinecraftServer.m_5705_(MinecraftServer.java:808)
at TRANSFORMER/[email protected]/net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:668)
at TRANSFORMER/[email protected]/net.minecraft.server.MinecraftServer.m_177918_(MinecraftServer.java:258)
at TRANSFORMER/[email protected]/net.minecraft.server.MinecraftServer$$Lambda$18189/0x0000000802e2f5d0.run(Unknown Source)
at [email protected]/java.lang.Thread.run(Thread.java:833)
Hey, I'm having a similar issue, and am working on a fork to improve the tile search, but in the meantime, a really, really fast hotfix that would help this would be just adding a check for if sage has any range in
https://github.com/JoeFoxe/Hexerei-1.18/blob/main/src/main/java/net/joefoxe/hexerei/events/SageBurningPlateEvent.java
//new line here
if(HexConfig.SAGE_BURNING_PLATE_RANGE.get()==0)return;
List<BlockPos> nearbySageBurningPlates = HexereiUtil.getAllTileEntityPositionsNearby(ModTileEntities.SAGE_BURNING_PLATE_TILE.get(), HexConfig.SAGE_BURNING_PLATE_RANGE.get() + 1, world, entity);
if (nearbySageBurningPlates.size() == 0) {
return;
}
If you add that line, then at least people that disable sage burning working at all won't get swamped during large world spawns. I'm taking a look at what that other helpful dude said in the other issue, but i would really appreciate it if you pushed this tiny change as a stopgap. I really want to run your mod in my modpack, I have some friends that really love what you've done.
https://pastebin.com/DT8YSjgr
looks like the same thing but sharing just in case it helps.
Awesome! Thank you for the tips and for working on a fork haha, I have been taking some mental time off which is why I havent been replying to much but I will start to work on it again more now
I can't continue work on the fork, but the best advice i didn't implement is just having a static list of positions by world of currently burning sage entities and checking if any of those entities were near enough instead of exhaustively by chunk.
I think this is related to #7
Here's a spark profiler showing similar issue: https://spark.lucko.me/k3preh2LJm