Closed L4BORG closed 2 years ago
> ver
[17:43:21 INFO]: Checking version, please wait...
[17:43:22 INFO]: This server is running Paper version git-Paper-408 (MC: 1.17.1) (Implementing API version 1.17.1-R0.1-SNAPSHOT) (Git: cc43ba7 on ver/1.17.1)
You are running the latest version
Previous version: git-Paper-404 (MC: 1.17.1)
Shouldn't really take that long to execute this even with the error, are you using SQL?
Also the reason for SpawnUtil.spawn(SpawnUtil.java:50)
is from a cancelled PetPreSpawnEvent
, do you have a plugin that is cancelling the event so?
No, using files to store player pets. Could cancelling PetPreSpawnEvent cause this? It's possible it's cancelled by one of plugins, not quite sure why it would cause exception or lag spike tho?
I've just checked logs (we also log coordinates) and it was in fact executed in PVP arena, which means:
@EventHandler
public void onPetSpawnEvent(PetPreSpawnEvent event) {
String reason = handlePetAtLocation(event.getSpawnLocation());
if (reason != null) {
Player player = event.getPet().getOwner();
if (player != null)
player.sendMessage(reason);
event.setCancelled(true);
}
}
would try to cancel it. But normally this wouldn't cause issues - unless for some reason it's only an issue when "two" pets are being spawned?
Yea, with another account without bypasses I can replicate this. So it appears cancelling PetPreSpawnEvent would cause issues if player would try to spawn two pets/mobs:
[04:57:13] [Server thread/INFO]: tester issued server command: /pet squid squid
[04:57:13] [Server thread/WARN]: com.destroystokyo.paper.exception.ServerCommandException: java.lang.NullPointerException: Cannot invoke "com.dsh105.echopet.compat.api.entity.IEntityPet.getEntity()" because the return value of "com.dsh105.echopet.api.pet.Pet.getEntityPet()" is null
[04:57:13] [Server thread/WARN]: at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:168)
[04:57:13] [Server thread/WARN]: at org.bukkit.craftbukkit.v1_17_R1.CraftServer.dispatchCommand(CraftServer.java:869)
[04:57:13] [Server thread/WARN]: at net.minecraft.server.network.PlayerConnection.handleCommand(PlayerConnection.java:2262)
[04:57:13] [Server thread/WARN]: at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:2073)
[04:57:13] [Server thread/WARN]: at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:2054)
[04:57:13] [Server thread/WARN]: at net.minecraft.network.protocol.game.PacketPlayInChat.a(PacketPlayInChat.java:46)
[04:57:13] [Server thread/WARN]: at net.minecraft.network.protocol.game.PacketPlayInChat.a(PacketPlayInChat.java:6)
[04:57:13] [Server thread/WARN]: at net.minecraft.network.protocol.PlayerConnectionUtils.lambda$ensureRunningOnSameThread$1(PlayerConnectionUtils.java:56)
[04:57:13] [Server thread/WARN]: at net.minecraft.server.TickTask.run(TickTask.java:18)
[04:57:13] [Server thread/WARN]: at net.minecraft.util.thread.IAsyncTaskHandler.executeTask(IAsyncTaskHandler.java:149)
[04:57:13] [Server thread/WARN]: at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.executeTask(IAsyncTaskHandlerReentrant.java:23)
[04:57:13] [Server thread/WARN]: at net.minecraft.server.MinecraftServer.executeTask(MinecraftServer.java:1426)
[04:57:13] [Server thread/WARN]: at net.minecraft.server.MinecraftServer.executeTask(MinecraftServer.java:192)
[04:57:13] [Server thread/WARN]: at net.minecraft.util.thread.IAsyncTaskHandler.executeNext(IAsyncTaskHandler.java:122)
[04:57:13] [Server thread/WARN]: at net.minecraft.server.MinecraftServer.bf(MinecraftServer.java:1404)
[04:57:13] [Server thread/WARN]: at net.minecraft.server.MinecraftServer.executeNext(MinecraftServer.java:1397)
[04:57:13] [Server thread/WARN]: at net.minecraft.util.thread.IAsyncTaskHandler.awaitTasks(IAsyncTaskHandler.java:132)
[04:57:13] [Server thread/WARN]: at net.minecraft.server.MinecraftServer.sleepForTick(MinecraftServer.java:1375)
[04:57:13] [Server thread/WARN]: at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1286)
[04:57:13] [Server thread/WARN]: at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319)
[04:57:13] [Server thread/WARN]: at java.base/java.lang.Thread.run(Thread.java:833)
[04:57:13] [Server thread/WARN]: Caused by: java.lang.NullPointerException: Cannot invoke "com.dsh105.echopet.compat.api.entity.IEntityPet.getEntity()" because the return value of "com.dsh105.echopet.api.pet.Pet.getEntityPet()" is null
[04:57:13] [Server thread/WARN]: at EchoPet.jar//com.dsh105.echopet.api.pet.Pet.getCraftPet(Pet.java:136)
[04:57:13] [Server thread/WARN]: at EchoPet.jar//com.dsh105.echopet.api.pet.Pet.removeRider(Pet.java:274)
[04:57:13] [Server thread/WARN]: at EchoPet.jar//com.dsh105.echopet.api.pet.Pet.removePet(Pet.java:285)
[04:57:13] [Server thread/WARN]: at EchoPet.jar//com.dsh105.echopet.api.PetManager.removePet(PetManager.java:343)
[04:57:13] [Server thread/WARN]: at EchoPet.jar//com.dsh105.echopet.compat.nms.v1_17_R1.SpawnUtil.spawn(SpawnUtil.java:50)
[04:57:13] [Server thread/WARN]: at EchoPet.jar//com.dsh105.echopet.api.pet.Pet.spawnPet(Pet.java:103)
[04:57:13] [Server thread/WARN]: at EchoPet.jar//com.dsh105.echopet.commands.PetCommand.onCommand(PetCommand.java:673)
[04:57:13] [Server thread/WARN]: at EchoPet.jar//com.dsh105.echopet.commands.util.DynamicPluginCommand.execute(DynamicPluginCommand.java:50)
[04:57:13] [Server thread/WARN]: at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159)
[04:57:13] [Server thread/WARN]: ... 20 more
[04:57:20] [Server thread/ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing 'pet squid squid' in com.dsh105.echopet.commands.util.DynamicPluginCommand(pet)
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:169) ~[patched_1.17.1.jar:git-Paper-408]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.dispatchCommand(CraftServer.java:869) ~[patched_1.17.1.jar:git-Paper-408]
at net.minecraft.server.network.ServerGamePacketListenerImpl.handleCommand(ServerGamePacketListenerImpl.java:2262) ~[app:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.handleChat(ServerGamePacketListenerImpl.java:2073) ~[app:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.handleChat(ServerGamePacketListenerImpl.java:2054) ~[app:?]
at net.minecraft.network.protocol.game.ServerboundChatPacket.handle(ServerboundChatPacket.java:46) ~[app:?]
at net.minecraft.network.protocol.game.ServerboundChatPacket.a(ServerboundChatPacket.java:6) ~[app:?]
at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$1(PacketUtils.java:56) ~[app:?]
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[patched_1.17.1.jar:git-Paper-408]
at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:149) ~[app:?]
at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:23) ~[app:?]
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1426) ~[patched_1.17.1.jar:git-Paper-408]
at net.minecraft.server.MinecraftServer.executeTask(MinecraftServer.java:192) ~[patched_1.17.1.jar:git-Paper-408]
at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:122) ~[app:?]
at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1404) ~[patched_1.17.1.jar:git-Paper-408]
at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1397) ~[patched_1.17.1.jar:git-Paper-408]
at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:132) ~[app:?]
at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1375) ~[patched_1.17.1.jar:git-Paper-408]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1286) ~[patched_1.17.1.jar:git-Paper-408]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) ~[patched_1.17.1.jar:git-Paper-408]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.NullPointerException: Cannot invoke "com.dsh105.echopet.compat.api.entity.IEntityPet.getEntity()" because the return value of "com.dsh105.echopet.api.pet.Pet.getEntityPet()" is null
at com.dsh105.echopet.api.pet.Pet.getCraftPet(Pet.java:136) ~[EchoPet.jar:?]
at com.dsh105.echopet.api.pet.Pet.removeRider(Pet.java:274) ~[EchoPet.jar:?]
at com.dsh105.echopet.api.pet.Pet.removePet(Pet.java:285) ~[EchoPet.jar:?]
at com.dsh105.echopet.api.PetManager.removePet(PetManager.java:343) ~[EchoPet.jar:?]
at com.dsh105.echopet.compat.nms.v1_17_R1.SpawnUtil.spawn(SpawnUtil.java:50) ~[EchoPet.jar:?]
at com.dsh105.echopet.api.pet.Pet.spawnPet(Pet.java:103) ~[EchoPet.jar:?]
at com.dsh105.echopet.commands.PetCommand.onCommand(PetCommand.java:673) ~[EchoPet.jar:?]
at com.dsh105.echopet.commands.util.DynamicPluginCommand.execute(DynamicPluginCommand.java:50) ~[EchoPet.jar:?]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159) ~[patched_1.17.1.jar:git-Paper-408]
... 20 more
[04:57:20] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 6356ms or 127 ticks behind
[04:57:20] [Server thread/INFO]: Warning low TPS: 4.79
[04:57:20] [Server thread/INFO]: TPS history: 4.79, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20
https://github.com/Arnuh/EchoPet/commit/fd77d7332861b412e1638b27784628b756c93155 should fix PetPreSpawnEvent
cancels throwing errors, im not exactly sure why it would lag the server. Since you can reproduce the lag you can check if its a separate issue. I did a quick test with logins and all pet spawning(with rider) is handled in a couple ms.
Not sure what version you're currently using but I should note dev obviously means it isn't fully confirmed stable.
Understood, using latest dev it seems https://github.com/Arnuh/EchoPet/commit/fd77d7332861b412e1638b27784628b756c93155 fixed the issue :)
I think there might still be something strange going on when pets are being despawned using PetPreSpawnEvent but it doesn't cause lag or exceptions anymore.
The only strange thing now I guess is PetPreSpawnEvent being fired twice, tho I'm not sure if that's EchoPet issue:
It seems like it would only happen on teleport tho and it doesn't matter if there are two pets or just one. If I warp to pvp and try to spawn (one or two pets) it would work correctly, PetPreSpawnEvent is fired once. But if I have pet spawned and try to warp to pvp arena, PetPreSpawnEvent would get fired twice for some reason.
I tried printing location in PetPreSpawnEvent (with only one pet):
[05:25:53 INFO]: Location{world=CraftWorld{name=world_empty},x=-0.5,y=110.0,z=3.5,pitch=-0.9000609,yaw=136.35}
[05:25:53 INFO]: Location{world=CraftWorld{name=world_empty},x=-0.5,y=110.0,z=3.5,pitch=-0.9000609,yaw=136.35}
so not sure what is going on. This was already an issue before your fix tho.
Could be teleportToOwner trying to spawn the pets again. Also, the echopet message is kind of weird now if you do a custom one, not sure the best approach for that, could be best to just remove it? Since a plugin is the only cause and they can give an error if they want.
Yea, I think it would make sense to remove it, maybe the alternative would be to add setCancelReason to PetPreSpawnEvent? Maybe set default cancelReason to current message and if PetPreSpawnEvent is cancelled, then cancelReason would be sent to the player? And if cancelReason is null EchoPet would not send any msgs to the player (meaning it's up to the plugin cancelling it to msg the player)?
Kinda depends on what plugin dev is trying to do. In a way if one would want cool msgs... it would look "fancier" if "Pets are not allowed in PVP World" is sent by EchoPet? The way we do it now is kinda ugly but well... I guess in some cases it would also make sense to allow "silent" despawns.
I'm not quite sure what happened here and I'm unable to replicate... if I execute the same command it would work without any issues... happened with EchoPet https://github.com/Arnuh/EchoPet/commit/364668f72650cbe2ec4d605219d4f2c8fcf01c97