Gennario / RotatingHeads2

MIT License
6 stars 8 forks source link

console spam #11

Open int3iku opened 2 days ago

int3iku commented 2 days ago

purpur 1.16.5 java 17 [20:44:29 WARN]: [RotatingHeads2] Plugin RotatingHeads2 v1.2.0 generated an exception while executing task 15 java.lang.NegativeArraySizeException: -1 at java.util.Arrays.copyOf(Arrays.java:3512) ~[?:?] at java.util.Arrays.copyOf(Arrays.java:3481) ~[?:?] at java.util.ArrayList.toArray(ArrayList.java:369) ~[?:?] at java.util.ArrayList.(ArrayList.java:181) ~[?:?] at cz.gennario.newrotatingheads.system.RotatingHead.spawn(RotatingHead.java:307) ~[?:?] at cz.gennario.newrotatingheads.system.HeadRunnable.run(HeadRunnable.java:28) ~[?:?] at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:100) ~[patched_1.16.5.jar:git-Purpur-1171] at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:58) ~[patched_1.16.5.jar:git-Purpur-1171] at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[patched_1.16.5.jar:git-Purpur-1171] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?] at java.lang.Thread.run(Thread.java:842) [?:?]

SolsticeSpectrum commented 2 days ago

This is caused by certain array being accessed from more than one thread. We fixed this before with other arrays by using thread safe arrays but this one slipped under our noses. I found the problematic array that needs to be replaced with thread safe version https://github.com/Gennario/RotatingHeads2/blob/main/src%2Fmain%2Fjava%2Fcz%2Fgennario%2Fnewrotatingheads%2Fsystem%2FHeadRunnable.java#L15

We should also take a look at other arrays to make sure this issue doesn't linger.