PaperMC / Paper

The most widely used, high performance Minecraft server that aims to fix gameplay and mechanics inconsistencies
https://papermc.io/
Other
9.67k stars 2.25k forks source link

Zombie reinforcement checking crashing server by triggering sync chunk loads #11174

Open NewwindServer opened 1 month ago

NewwindServer commented 1 month ago

Stack trace

[21:07:35] [Paper Watchdog Thread/ERROR]: The server has stopped responding! This is (probably) not a Paper bug.
[21:07:35] [Paper Watchdog Thread/ERROR]: If you see a plugin in the Server thread dump below, then please report it to that author
[21:07:35] [Paper Watchdog Thread/ERROR]:    *Especially* if it looks like HTTP or MySQL operations are occurring
[21:07:35] [Paper Watchdog Thread/ERROR]: If you see a world save or edit, then it means you did far more than your server can handle at once
[21:07:35] [Paper Watchdog Thread/ERROR]:    If this is the case, consider increasing timeout-time in spigot.yml but note that this will replace the crash with LARGE lag spikes
[21:07:35] [Paper Watchdog Thread/ERROR]: If you are unsure or still think this is a Paper bug, please report this to https://github.com/PaperMC/Paper/issues
[21:07:35] [Paper Watchdog Thread/ERROR]: Be sure to include ALL relevant console errors and Minecraft crash reports
[21:07:35] [Paper Watchdog Thread/ERROR]: Paper version: 1.21-DEV-5a5035b (MC: 1.21)
[21:07:35] [Paper Watchdog Thread/ERROR]: ------------------------------
[21:07:35] [Paper Watchdog Thread/ERROR]: Server thread dump (Look for plugins here before reporting to Paper!):
[21:07:35] [Paper Watchdog Thread/ERROR]: [ChunkTaskScheduler] Chunk wait task info below: 
[21:07:35] [Paper Watchdog Thread/ERROR]: [ChunkTaskScheduler] Chunk wait: [( -297,-263) in 'world_newwind_summer_world_2024']
[21:07:35] [Paper Watchdog Thread/ERROR]: [ChunkTaskScheduler] Chunk holder: NewChunkHolder{world=world_newwind_summer_world_2024, chunkX=-297, chunkZ=-263, entityChunkFromDisk=false, lastChunkCompletion={chunk_class=net.minecraft.world.level.chunk.ProtoChunk,status=minecraft:initialize_light}, currentGenStatus=minecraft:initialize_light, requestedGenStatus=minecraft:full, generationTask=null, generationTaskStatus=null, priority=BLOCKING, priorityLocked=false, neighbourRequestedPriority=null, effective_priority=BLOCKING, oldTicketLevel=33, currentTicketLevel=33, totalNeighboursUsingThisChunk=0, fullNeighbourChunksLoadedBitset=33550335, currentChunkStatus=INACCESSIBLE, pendingChunkStatus=INACCESSIBLE, is_unload_safe=ticket_level, killed=false}
[21:07:35] [Paper Watchdog Thread/ERROR]: [ChunkTaskScheduler] Writing chunk information dump to ./debug/chunks-2024-07-26_21.07.35.txt
[21:07:36] [Paper Watchdog Thread/ERROR]: [ChunkTaskScheduler] Successfully written chunk information!
[21:07:36] [Paper Watchdog Thread/ERROR]: Ticking entity: minecraft:zombie, entity class: net.minecraft.world.entity.monster.Zombie
[21:07:36] [Paper Watchdog Thread/ERROR]: Entity status: removed: false, valid: true, alive: true, is passenger: false
[21:07:36] [Paper Watchdog Thread/ERROR]: Entity UUID: c4ca0f3f-436b-436b-8021-334d2ca4dcc6
[21:07:36] [Paper Watchdog Thread/ERROR]: Position: world: 'world_newwind_summer_world_2024' at location (-4702.599893702036, 177.0, -4246.5851946758885)
[21:07:36] [Paper Watchdog Thread/ERROR]: Velocity: (-0.03958221019641342, -0.0784000015258789, -0.04471509276946656) (in blocks per tick)
[21:07:36] [Paper Watchdog Thread/ERROR]: Entity AABB: AABB[-4702.899893713957, 177.0, -4246.885194687809] -> [-4702.299893690115, 178.95000004768372, -4246.285194663968]
[21:07:36] [Paper Watchdog Thread/ERROR]: ------------------------------
[21:07:36] [Paper Watchdog Thread/ERROR]: Current Thread: Server thread
[21:07:36] [Paper Watchdog Thread/ERROR]:   PID: 63 | Suspended: false | Native: false | State: TIMED_WAITING
[21:07:36] [Paper Watchdog Thread/ERROR]:   Stack:
[21:07:36] [Paper Watchdog Thread/ERROR]:       java.base@21.0.3/jdk.internal.misc.Unsafe.park(Native Method)
[21:07:36] [Paper Watchdog Thread/ERROR]:       java.base@21.0.3/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:269)
[21:07:36] [Paper Watchdog Thread/ERROR]:       net.minecraft.util.thread.BlockableEventLoop.waitForTasks(BlockableEventLoop.java:146)
[21:07:36] [Paper Watchdog Thread/ERROR]:       net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136)
[21:07:36] [Paper Watchdog Thread/ERROR]:       net.minecraft.server.level.ServerChunkCache$MainThreadExecutor.managedBlock(ServerChunkCache.java:706)
[21:07:36] [Paper Watchdog Thread/ERROR]:       net.minecraft.server.level.ServerChunkCache.syncLoad(ServerChunkCache.java:101)
[21:07:36] [Paper Watchdog Thread/ERROR]:       net.minecraft.server.level.ServerChunkCache.getChunkFallback(ServerChunkCache.java:126)
[21:07:36] [Paper Watchdog Thread/ERROR]:       net.minecraft.server.level.ServerChunkCache.getChunk(ServerChunkCache.java:235)
[21:07:36] [Paper Watchdog Thread/ERROR]:       net.minecraft.world.level.Level.getChunk(Level.java:1001)
[21:07:36] [Paper Watchdog Thread/ERROR]:       net.minecraft.world.level.Level.getBlockState(Level.java:1275)
[21:07:36] [Paper Watchdog Thread/ERROR]:       net.minecraft.world.entity.SpawnPlacementTypes$1.isSpawnPositionOk(SpawnPlacementTypes.java:30)
[21:07:36] [Paper Watchdog Thread/ERROR]:       net.minecraft.world.entity.SpawnPlacements.isSpawnPositionOk(SpawnPlacements.java:64)
[21:07:36] [Paper Watchdog Thread/ERROR]:       net.minecraft.world.entity.monster.Zombie.hurt(Zombie.java:347)
[21:07:36] [Paper Watchdog Thread/ERROR]:       net.minecraft.world.effect.WitherMobEffect.applyEffectTick(WitherMobEffect.java:12)
[21:07:36] [Paper Watchdog Thread/ERROR]:       net.minecraft.world.effect.MobEffectInstance.tick(MobEffectInstance.java:222)
[21:07:36] [Paper Watchdog Thread/ERROR]:       net.minecraft.world.entity.LivingEntity.tickEffects(LivingEntity.java:936)
[21:07:36] [Paper Watchdog Thread/ERROR]:       net.minecraft.world.entity.LivingEntity.baseTick(LivingEntity.java:542)
[21:07:36] [Paper Watchdog Thread/ERROR]:       net.minecraft.world.entity.Mob.baseTick(Mob.java:368)
[21:07:36] [Paper Watchdog Thread/ERROR]:       net.minecraft.world.entity.Entity.tick(Entity.java:848)
[21:07:36] [Paper Watchdog Thread/ERROR]:       net.minecraft.world.entity.LivingEntity.tick(LivingEntity.java:3132)
[21:07:36] [Paper Watchdog Thread/ERROR]:       net.minecraft.world.entity.Mob.tick(Mob.java:445)
[21:07:36] [Paper Watchdog Thread/ERROR]:       net.minecraft.world.entity.monster.Zombie.tick(Zombie.java:241)
[21:07:36] [Paper Watchdog Thread/ERROR]:       net.minecraft.server.level.ServerLevel.tickNonPassenger(ServerLevel.java:1291)
[21:07:36] [Paper Watchdog Thread/ERROR]:       net.minecraft.server.level.ServerLevel$$Lambda/0x00007f522dc55d18.accept(Unknown Source)
[21:07:36] [Paper Watchdog Thread/ERROR]:       net.minecraft.world.level.Level.guardEntityTick(Level.java:1420)
[21:07:36] [Paper Watchdog Thread/ERROR]:       net.minecraft.server.level.ServerLevel.lambda$tick$6(ServerLevel.java:780)
[21:07:36] [Paper Watchdog Thread/ERROR]:       net.minecraft.server.level.ServerLevel$$Lambda/0x00007f522dc55880.accept(Unknown Source)
[21:07:36] [Paper Watchdog Thread/ERROR]:       net.minecraft.world.level.entity.EntityTickList.forEach(EntityTickList.java:39)
[21:07:36] [Paper Watchdog Thread/ERROR]:       net.minecraft.server.level.ServerLevel.tick(ServerLevel.java:760)
[21:07:36] [Paper Watchdog Thread/ERROR]:       net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1805)
[21:07:36] [Paper Watchdog Thread/ERROR]:       net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:473)
[21:07:36] [Paper Watchdog Thread/ERROR]:       net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1597)
[21:07:36] [Paper Watchdog Thread/ERROR]:       net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1303)
[21:07:36] [Paper Watchdog Thread/ERROR]:       net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:330)
[21:07:36] [Paper Watchdog Thread/ERROR]:       net.minecraft.server.MinecraftServer$$Lambda/0x00007f522cc9b3e8.run(Unknown Source)
[21:07:36] [Paper Watchdog Thread/ERROR]:       java.base@21.0.3/java.lang.Thread.runWith(Thread.java:1596)
[21:07:36] [Paper Watchdog Thread/ERROR]:       java.base@21.0.3/java.lang.Thread.run(Thread.java:1583)

Plugin and Datapack List

N/A

Actions to reproduce (if known)

When a zombie gets hurt there is a chance it will attempt 50 times to spawn reinforcements within a +-40 block radius.

if (entityliving != null && this.level().getDifficulty() == Difficulty.HARD && (double) this.random.nextFloat() < this.getAttributeValue(Attributes.SPAWN_REINFORCEMENTS_CHANCE) && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)) {
                int i = Mth.floor(this.getX());
                int j = Mth.floor(this.getY());
                int k = Mth.floor(this.getZ());
                Zombie entityzombie = new Zombie(this.level());

                for (int l = 0; l < 50; ++l) {
                    int i1 = i + Mth.nextInt(this.random, 7, 40) * Mth.nextInt(this.random, -1, 1);
                    int j1 = j + Mth.nextInt(this.random, 7, 40) * Mth.nextInt(this.random, -1, 1);
                    int k1 = k + Mth.nextInt(this.random, 7, 40) * Mth.nextInt(this.random, -1, 1);
                    BlockPos blockposition = new BlockPos(i1, j1, k1);
                    EntityType<?> entitytypes = entityzombie.getType();

                    // **** Sync chunk load occurs here ****
                    if (SpawnPlacements.isSpawnPositionOk(entitytypes, this.level(), blockposition) && SpawnPlacements.checkSpawnRules(entitytypes, worldserver, MobSpawnType.REINFORCEMENT, blockposition, this.level().random)) { 
                        entityzombie.setPos((double) i1, (double) j1, (double) k1);
                        if (!this.level().hasNearbyAlivePlayerThatAffectsSpawning((double) i1, (double) j1, (double) k1, 7.0D) && this.level().isUnobstructed(entityzombie) && this.level().noCollision((Entity) entityzombie) && !this.level().containsAnyLiquid(entityzombie.getBoundingBox())) { // Paper - Affects Spawning API
                            entityzombie.setTarget(entityliving, EntityTargetEvent.TargetReason.REINFORCEMENT_TARGET, true); // CraftBukkit
                            entityzombie.finalizeSpawn(worldserver, this.level().getCurrentDifficultyAt(entityzombie.blockPosition()), MobSpawnType.REINFORCEMENT, (SpawnGroupData) null);
                            worldserver.addFreshEntityWithPassengers(entityzombie, CreatureSpawnEvent.SpawnReason.REINFORCEMENTS); // CraftBukkit
                            AttributeInstance attributemodifiable = this.getAttribute(Attributes.SPAWN_REINFORCEMENTS_CHANCE);
                            AttributeModifier attributemodifier = attributemodifiable.getModifier(Zombie.REINFORCEMENT_CALLER_CHARGE_ID);
                            double d0 = attributemodifier != null ? attributemodifier.amount() : 0.0D;

                            attributemodifiable.removeModifier(Zombie.REINFORCEMENT_CALLER_CHARGE_ID);
                            attributemodifiable.addPermanentModifier(new AttributeModifier(Zombie.REINFORCEMENT_CALLER_CHARGE_ID, d0 - 0.05D, AttributeModifier.Operation.ADD_VALUE));
                            entityzombie.getAttribute(Attributes.SPAWN_REINFORCEMENTS_CHANCE).addPermanentModifier(Zombie.ZOMBIE_REINFORCEMENT_CALLEE_CHARGE);
                            break;
                        }
                    }
                }
            }

isSpawnPositionOk() triggers a sync chunk load.

Paper version

This server is running Paper version 1.21-DEV-master@5a5035b (2024-07-25T12:25:25Z) (Implementing API version 1.21-R0.1-SNAPSHOT) You are 1 version(s) behind Download the new version at: https://papermc.io/downloads/paper Previous version: git-Paper-"f4c7d37" (MC: 1.20.4)

Other

I will open a PR to prevent isSpawnPositionOK() from loading chunks

electronicboy commented 1 month ago

partial watchdog reports are useless