RobertZenz / org.bonsaimind.bukkitplugins

Plugins for Bukkit, a free Minecraft-Server-Addition.
http://bukkitplugins.bonsaimind.org
2 stars 3 forks source link

ConcurrentModificationException #15

Closed admalledd closed 11 years ago

admalledd commented 11 years ago
org.bukkit.command.CommandException: Unhandled exception executing 'save-all' in org.bukkit.command.defaults.SaveCommand(save-all)
16:45:21 [SEVERE]       at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:190)
16:45:21 [SEVERE]       at org.bukkit.craftbukkit.v1_4_R1.CraftServer.dispatchCommand(CraftServer.java:514)
16:45:21 [SEVERE]       at org.bonsaimind.bukkitplugins.simplecronclone.Engine.parseScriptLine(Unknown Source)
16:45:21 [SEVERE]       at org.bonsaimind.bukkitplugins.simplecronclone.Engine.executeScript(Unknown Source)
16:45:21 [SEVERE]       at org.bonsaimind.bukkitplugins.simplecronclone.Engine$1.run(Unknown Source)
16:45:21 [SEVERE]       at it.sauronsoftware.cron4j.RunnableTask.execute(Unknown Source)
16:45:21 [SEVERE]       at it.sauronsoftware.cron4j.TaskExecutor$Runner.run(Unknown Source)
16:45:21 [SEVERE]       at java.lang.Thread.run(Thread.java:722)
16:45:21 [SEVERE] Caused by: java.util.ConcurrentModificationException
16:45:21 [SEVERE]       at org.bukkit.craftbukkit.v1_4_R1.util.LongObjectHashMap$ValueIterator.next(LongObjectHashMap.java:299)
16:45:21 [SEVERE]       at net.minecraft.server.v1_4_R1.ChunkProviderServer.saveChunks(ChunkProviderServer.java:257)
16:45:21 [SEVERE]       at net.minecraft.server.v1_4_R1.WorldServer.save(WorldServer.java:709)
16:45:21 [SEVERE]       at org.bukkit.craftbukkit.v1_4_R1.CraftWorld.save(CraftWorld.java:648)
16:45:21 [SEVERE]       at org.bukkit.command.defaults.SaveCommand.execute(SaveCommand.java:30)
16:45:21 [SEVERE]       at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:186)
16:45:21 [SEVERE]       ... 7 more

looks like we will have to send the commands to the main thread and have a executor call back there. (note to self, see: http://wiki.bukkit.org/Scheduler_Programming for docs on where to get started)

admalledd commented 11 years ago

fixed in fc05d7bea5c97c37f5840e265249138a0fc77ae7, basically told the engine.java to use the callback scheduler into the main thread with the Bukkit.getServer().getScheduler().scheduleSyncDelayedTask()