[SPIGOT-646] Bukkit.getOfflinePlayer() causing ConcurrentModificationException Created: 05/Mar/15  Updated: 14/Mar/15  Resolved: 09/Mar/15

Status: Closed
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: mibby mibster Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None

Plugin: ChestShops

 Description   

Spigot git-Spigot-c3c767f-33d5de3

http://dev.bukkit.org/bukkit-plugins/chestshop/tickets/988-chance-of-java-util-concurrent-modification-exception/#comments

On server start-up / restarts, there is a chance that ChestShops does not enable and instead outputs a ConcurrentModificationException error. Restarting the server again usually fixes the issue.

ChestShops developer states it seems to be an issue within Spigot, as "Bukkit.getOfflinePlayer()" should be safe to use.

[00:00:17] [Server thread/INFO]: [ChestShop] Enabling ChestShop v3.8.3
[00:00:17] [Server thread/ERROR]: Error occurred while enabling ChestShop v3.8.3 (Is it up to date?)
java.util.ConcurrentModificationException
at java.util.LinkedList$ListItr.checkForComodification(LinkedList.java:966) ~[?:1.8.0_40]
at java.util.LinkedList$ListItr.next(LinkedList.java:888) ~[?:1.8.0_40]
at com.google.common.collect.Iterators$9.next(Iterators.java:939) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
at com.google.common.collect.Iterators.addAll(Iterators.java:357) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
at com.google.common.collect.Lists.newArrayList(Lists.java:147) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.UserCache.a(UserCache.java:213) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.UserCache.c(UserCache.java:194) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.UserCache.getProfile(UserCache.java:123) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.craftbukkit.v1_8_R1.CraftServer.getOfflinePlayer(CraftServer.java:1290) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.Bukkit.getOfflinePlayer(Bukkit.java:741) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
at com.Acrobot.ChestShop.UUIDs.NameManager.load(NameManager.java:197) ~[?:?]
at com.Acrobot.ChestShop.ChestShop.onEnable(ChestShop.java:105) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:335) [spigot.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [spigot.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.craftbukkit.v1_8_R1.CraftServer.loadPlugin(CraftServer.java:356) [spigot.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.craftbukkit.v1_8_R1.CraftServer.enablePlugins(CraftServer.java:316) [spigot.jar:git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.MinecraftServer.q(MinecraftServer.java:402) [spigot.jar:git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.MinecraftServer.k(MinecraftServer.java:370) [spigot.jar:git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.MinecraftServer.a(MinecraftServer.java:325) [spigot.jar:git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.DedicatedServer.init(DedicatedServer.java:211) [spigot.jar:git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java:505) [spigot.jar:git-Spigot-c3c767f-33d5de3]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_40]



 Comments   
Comment by mibby mibster [ 14/Mar/15 ]

This is still an on-going issue with Spigot 1.8.3 (git-Spigot-ea179b3-6e0120a) and ChestShops 3.8.5. Becoming quite an annoyance.

http://paste.ubuntu.com/10593962/

Could you please make the getOfflinePlayer check async and thread safe to prevent ConcurrentModificationException on server startup?

https://hub.spigotmc.org/jira/browse/SPIGOT-461

Comment by md_5 [ 09/Mar/15 ]

It's not safe to use, nowhere does any documentation state that from either the former Bukkit team nor ourselves. In this case however it probably isn't chestshop, rather another plugin operating concurrently.

There is another ticket somewhere to make this method safe.

Comment by mibby mibster [ 09/Mar/15 ]

Well as I stated, I didn't really begin to experience this issue until I updated Spigot and ChestShops to version 3.8.1+ a few weeks ago.

I noticed these two recent commits in the ChestShops repo. Could they be the cause?

https://github.com/Acrobot/ChestShop-3/commit/f975450130c5b0f627e7dd7df912a9789222e156

https://github.com/Acrobot/ChestShop-3/commit/8c77057703fa792a2dae931025015375846ce8ee

Comment by Thinkofname [ 08/Mar/15 ]

No easy way to tell, also no changes have been made to that area of code for months by spigot/cb

Comment by mibby mibster [ 08/Mar/15 ]

Such as? Is there any way to know? I didn't really start to experience this issue until about a week or two ago when I updated Spigot. According to the plugin dev, he states this is an issue within Spigot.
http://dev.bukkit.org/bukkit-plugins/chestshop/tickets/988-chance-of-java-util-concurrent-modification-exception/#c4

Plugins (40): AsyncWorldEditInjector, dynmap, WorldEdit, Essentials, LogBlock, AutoMessage, WorldBorder, Votifier, TrailGUI, ProtocolLib, WorldGuard, LibsDisguises, AsyncWorldEdit, VoxelSniper, EssentialsChat, PermissionsEx, EssentialsAntiBuild, Lottery, mcMMO, Vault, EssentialsSpawn, TitleManager, CasinoSlots, ButtonWarp, pvparena, CompatNoCheatPlus, MobArena, PwnFilter, LWC, NoCheatPlus, ColoredTags, VirtualPack, VanishNoPacket, ChestCommands, EchoPet, CraftBook, PlayerVaults, ServerSigns, EnjinMinecraftPlugin, ChestShop

Comment by Thinkofname [ 08/Mar/15 ]

Chances are you have another plugin on your server which is using getOfflinePlayer unsafely

Generated at Sat Dec 13 11:55:21 UTC 2025 using Jira 10.3.13#10030013-sha1:56dd970ae30ebfeda3a697d25be1f6388b68a422.