ZHorse

ZHorse

10.4k Downloads

CME caused by EventManager onChunkLoad

lagnat opened this issue ยท 1 comments

commented

This is an intermittent problem but ZHorse is the second plugin I've had create this CME and I'm very certain of what is happening.

Under certain circumstances, when your onChunkLoad() called, the chunk is already unloaded (?) and getEntities() has to fetch the chunk again. When that happens, it creates a recursion inside vanilla code which is not designed to handled it and it throws the CME.

Please see the bottom of https://hub.spigotmc.org/jira/browse/SPIGOT-5116 for a little more analysis.

Here's the relevant portion of the stack trace that shows it happening.

net.minecraft.server.v1_14_R1.ChunkProviderServer.getChunkFutureMainThread(ChunkProviderServer.java:142) ~[spigot-1.14.3-R0.1-SNAPSHOT.jar:git-Spigot-935adb3-a0e4747]
	at net.minecraft.server.v1_14_R1.ChunkProviderServer.getChunkAt(ChunkProviderServer.java:89) ~[spigot-1.14.3-R0.1-SNAPSHOT.jar:git-Spigot-935adb3-a0e4747]
	at net.minecraft.server.v1_14_R1.IChunkProvider.getChunkAt(SourceFile:16) ~[spigot-1.14.3-R0.1-SNAPSHOT.jar:git-Spigot-935adb3-a0e4747]
	at org.bukkit.craftbukkit.v1_14_R1.CraftWorld.getChunkAt(CraftWorld.java:321) ~[spigot-1.14.3-R0.1-SNAPSHOT.jar:git-Spigot-935adb3-a0e4747]
	at org.bukkit.craftbukkit.v1_14_R1.CraftChunk.getEntities(CraftChunk.java:97) ~[spigot-1.14.3-R0.1-SNAPSHOT.jar:git-Spigot-935adb3-a0e4747]
	at com.github.zedd7.zhorse.utils.ChunkLoad.<init>(ChunkLoad.java:16) ~[?:?]
	at com.github.zedd7.zhorse.managers.EventManager.onChunkLoad(EventManager.java:49) ~[?:?]
commented

Latest spigot has a fix for this