xCykrix / DynamicLights

Spigot/Paper Plugin for Simple Dynamic Lights
https://www.spigotmc.org/resources/dynamiclights.110707/
5 stars 1 forks source link

[BUG] Concurrent Modification on Disable #4

Closed xCykrix closed 1 year ago

xCykrix commented 1 year ago

Issue: Shutdown logic is concurrently reading and writing to LightManager#tasks. Fix: Add synchronization check and separate read/write/clear operations.

[03:57:01] [Server thread/ERROR]: Error occurred (in the plugin loader) while disabling DynamicLights v1.0.2-SNAPSHOT (Is it up to date?)
java.util.ConcurrentModificationException: null
    at java.util.HashMap$HashIterator.nextNode(HashMap.java:1597) ~[?:?]
    at java.util.HashMap$KeyIterator.next(HashMap.java:1620) ~[?:?]
    at com.github.xcykrix.dynamiclights.util.LightManager.shutdown(LightManager.java:44) ~[DynamicLights-1.0.2-SNAPSHOT.jar:?]
    at com.github.xcykrix.dynamiclights.DynamicLights.shutdown(DynamicLights.java:35) ~[DynamicLights-1.0.2-SNAPSHOT.jar:?]
    at com.github.xcykrix.plugincommon.PluginCommon.onDisable(PluginCommon.java:56) ~[DynamicLights-1.0.2-SNAPSHOT.jar:?]
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:283) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
    at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.disablePlugin(PaperPluginInstanceManager.java:224) ~[paper-1.20.1.jar:git-Paper-43]
    at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.disablePlugins(PaperPluginInstanceManager.java:148) ~[paper-1.20.1.jar:git-Paper-43]
    at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.disablePlugins(PaperPluginManagerImpl.java:92) ~[paper-1.20.1.jar:git-Paper-43]
    at org.bukkit.plugin.SimplePluginManager.disablePlugins(SimplePluginManager.java:528) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.craftbukkit.v1_20_R1.CraftServer.disablePlugins(CraftServer.java:567) ~[paper-1.20.1.jar:git-Paper-43]
    at net.minecraft.server.MinecraftServer.stopServer(MinecraftServer.java:943) ~[paper-1.20.1.jar:git-Paper-43]
    at net.minecraft.server.dedicated.DedicatedServer.stopServer(DedicatedServer.java:806) ~[paper-1.20.1.jar:git-Paper-43]
    at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1210) ~[paper-1.20.1.jar:git-Paper-43]
    at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:318) ~[paper-1.20.1.jar:git-Paper-43]
    at java.lang.Thread.run(Thread.java:833) ~[?:?]