Metadev-Digital / MobHunting

Mob hunting plugin for Minecraft Servers
0 stars 0 forks source link

ConcurrentModificationException in saveData #9

Closed Kevin-Sherman closed 1 month ago

Kevin-Sherman commented 1 month ago
[22:50:43] [BGC TaskThread/WARN]: Exception in thread "BGC TaskThread" java.util.ConcurrentModificationException
[22:50:43] [BGC TaskThread/WARN]:   at java.base/java.util.HashMap$HashIterator.nextNode(HashMap.java:1605)
[22:50:43] [BGC TaskThread/WARN]:   at java.base/java.util.HashMap$EntryIterator.next(HashMap.java:1638)
[22:50:43] [BGC TaskThread/WARN]:   at java.base/java.util.HashMap$EntryIterator.next(HashMap.java:1636)
[22:50:43] [BGC TaskThread/WARN]:   at metadev.digital.metacustomitemslib.rewards.RewardBlockManager.saveData(RewardBlockManager.java:88)
[22:50:43] [BGC TaskThread/WARN]:   at metadev.digital.metacustomitemslib.storage.async.StoreTask.run(StoreTask.java:34)
[22:50:43] [BGC TaskThread/WARN]:   at metadev.digital.metacustomitemslib.storage.async.StoreTask.run(StoreTask.java:11)
[22:50:43] [BGC TaskThread/WARN]:   at metadev.digital.metacustomitemslib.storage.DataStoreManager$TaskThread.run(DataStoreManager.java:301)

Possibly because it is removing off of the iterator, when saving during a hard tick or server delay it gets stuck.

Kevin-Sherman commented 1 month ago

Changed timing of remove operation in CustomItemsLib RewardBlockManager.saveData to avoid tripping over multithreaded task. Done in https://github.com/Metadev-Digital/CustomItemsLib/releases/tag/2.1.3