DiscordSRV

DiscordSRV

86.8k Downloads

ConcurrentModificationException whilst getting total player count

Vankka opened this issue ยท 0 comments

commented

Expected behavior

No error

Actual behavior

[25.09 19:05:58] [Server] [WARN] Exception in thread "DiscordSRV - Channel Updater" java.util.ConcurrentModificationException
[25.09 19:05:58] [Server] [WARN]     at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1221)
[25.09 19:05:58] [Server] [WARN]     at net.minecraft.world.level.storage.Convertable$ConversionSession.a(Convertable.java:410)
[25.09 19:05:58] [Server] [WARN]     at org.bukkit.craftbukkit.v1_19_R1.CraftWorld.getWorldFolder(CraftWorld.java:1561)
[25.09 19:05:58] [Server] [WARN]     at DiscordSRV-Build-1.26.0.jar//github.scarsz.discordsrv.DiscordSRV.getTotalPlayerCount(DiscordSRV.java:2231)
[25.09 19:05:58] [Server] [WARN]     at DiscordSRV-Build-1.26.0.jar//github.scarsz.discordsrv.util.PlaceholderUtil.replaceChannelUpdaterPlaceholders(PlaceholderUtil.java:96)
[25.09 19:05:58] [Server] [WARN]     at DiscordSRV-Build-1.26.0.jar//github.scarsz.discordsrv.objects.threads.ChannelUpdater$UpdaterChannel.update(ChannelUpdater.java:142)
[25.09 19:05:58] [Server] [WARN]     at DiscordSRV-Build-1.26.0.jar//github.scarsz.discordsrv.objects.threads.ChannelUpdater.reload(ChannelUpdater.java:87)
[25.09 19:05:58] [Server] [WARN]     at DiscordSRV-Build-1.26.0.jar//github.scarsz.discordsrv.objects.threads.ChannelUpdater.run(ChannelUpdater.java:93)

Steps to reproduce

Very hard to consistently reproduce, occurs when Minecraft itself and DiscordSRV attempt to access a resource related to world folders at the same time.

Server software and version

Not required

Checks

  • I am not using an outdated version of DiscordSRV.
  • I asked in DiscordSRV's Discord server to see whether this issue is in fact a bug that needs to be fixed.

Anything else

Can be easily fixed by getting total player count/the world folder on the main thread