r4g3baby / SimpleScore

A simple animated scoreboard plugin for your minecraft server.
https://www.spigotmc.org/resources/simplescore.23243/
MIT License
68 stars 34 forks source link

Stream of `java.lang.ArrayIndexOutOfBoundsException: null` exceptions #26

Closed badrpc closed 2 years ago

badrpc commented 2 years ago

Hello,

I'm seeing a stream of exceptions from SimpleScore plugin (see below) however the log doesn't include a stack trace so I'm not sure where exactly it happens. Do you have any suggestions on how to debug this further?

[20:17:32] [Server thread/WARN]: [SimpleScore] Task #3169 for SimpleScore v3.8.1 generated an exception
java.lang.ArrayIndexOutOfBoundsException: null
[20:17:32] [Server thread/WARN]: [SimpleScore] Task #3170 for SimpleScore v3.8.1 generated an exception
java.lang.ArrayIndexOutOfBoundsException: null
[20:17:32] [Server thread/WARN]: [SimpleScore] Task #3171 for SimpleScore v3.8.1 generated an exception
java.lang.ArrayIndexOutOfBoundsException: null
[20:17:32] [Server thread/WARN]: [SimpleScore] Task #3172 for SimpleScore v3.8.1 generated an exception
java.lang.ArrayIndexOutOfBoundsException: null
[20:17:32] [Server thread/WARN]: [SimpleScore] Task #3173 for SimpleScore v3.8.1 generated an exception
java.lang.ArrayIndexOutOfBoundsException: null
[20:17:32] [Server thread/WARN]: [SimpleScore] Task #3174 for SimpleScore v3.8.1 generated an exception
java.lang.ArrayIndexOutOfBoundsException: null

Server is paper-1.17.1 and I believe I had the same error with spigot.

r4g3baby commented 2 years ago

Hey, could you send me a copy of your full latest.log and your config file.

badrpc commented 2 years ago

Thank you for prompt response. Here are the files. I can see now trace in the first instance of the exception. I suppose the server is stripping trace from repeated exceptions.

[20:15:39] [Server thread/WARN]: [SimpleScore] Task #759 for SimpleScore v3.8.1 generated an exception
java.lang.ArrayIndexOutOfBoundsException: Index 13 out of bounds for length 13
    at java.util.HashMap.keysToArray(HashMap.java:952) ~[?:?]
    at java.util.HashMap$KeySet.toArray(HashMap.java:995) ~[?:?]
    at java.util.ArrayList.<init>(ArrayList.java:181) ~[?:?]
    at com.google.common.collect.Lists.newArrayList(Lists.java:132) ~[patched_1.17.1.jar:git-Paper-349]
    at net.minecraft.world.scores.Scoreboard.getTrackedPlayers(Scoreboard.java:115) ~[patched_1.17.1.jar:git-Paper-349]
    at org.bukkit.craftbukkit.v1_17_R1.scoreboard.CraftScore.getScore(CraftScore.java:44) ~[patched_1.17.1.jar:git-Paper-349]
    at com.r4g3baby.simplescore.scoreboard.handlers.BukkitScoreboard.updateScoreboard(BukkitScoreboard.kt:37) ~[SimpleScore-3.8.1.jar:?]
    at com.r4g3baby.simplescore.scoreboard.ScoreboardManager.updateScoreboard(ScoreboardManager.kt:109) ~[SimpleScore-3.8.1.jar:?]
    at com.r4g3baby.simplescore.scoreboard.tasks.ScoreboardTask.run$lambda-9(ScoreboardTask.kt:85) ~[SimpleScore-3.8.1.jar:?]
    at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftTask.run(CraftTask.java:101) ~[patched_1.17.1.jar:git-Paper-349]
    at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:483) ~[patched_1.17.1.jar:git-Paper-349]
    at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1564) ~[patched_1.17.1.jar:git-Paper-349]
    at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:490) ~[patched_1.17.1.jar:git-Paper-349]
    at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1480) ~[patched_1.17.1.jar:git-Paper-349]
    at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1279) ~[patched_1.17.1.jar:git-Paper-349]
    at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) ~[patched_1.17.1.jar:git-Paper-349]
    at java.lang.Thread.run(Thread.java:831) ~[?:?]

I'm puzzled with this trace to be honest - it appears to happen inside hash map code. Could the hash map become corrupted somehow? There aren't many results if I search for this error but one of them shows something very similar: https://github.com/DSheirer/sdrtrunk/issues/952

server.log config.yml.txt

badrpc commented 2 years ago

Just one small note: you asked for a full log but I had to redact it a bit to remove personal information and chats. I used this command: grep -Ev ' joined the game| logged in with entity id | UUID of player | tried to connect| Player connected with username |has connected to the Java server|Floodgate player logged in as|Async Chat Thread|\[DiscordSRV] Found server|\[DiscordSRV] - TC:|\[DiscordSRV] Console forwarding|\[DiscordSRV] Chat: \[Discord]' 2021-11-04-3.log | sed -E 's/[0-9]+.[0-9]+.[0-9]+.[0-9]+/[REDACTED]/g' | > server.log. I hope I haven't removed anything important.

r4g3baby commented 2 years ago

Well, this is a strange error indeed. My first guess was that it could be related to some concurrency issue however after checking out v3.8.1 I'm pretty sure we can rule that out since the scoreboard is always updated in the main thread.

Could you try to remove the special characters/unicode from the config and see if that makes a difference please.

badrpc commented 2 years ago

Thank you for the suggestion. I think that was it. Server has been running for several hours with players and no errors so far. I guess the main user of the server (who is not me) will have to redesign the scoreboard.

r4g3baby commented 2 years ago

Interesting, I'll keep this open for now so I can see if there are any workarounds that I can implement to fix this.

r4g3baby commented 2 years ago

Finally had some time to properly test this and seems to be working fine with the same config on the latest dev version. Gonna close it now as I will be releasing a new version soon.