ServerCore

ServerCore

7M Downloads

Intermittent ArrayIndexOutOfBoundsException crash during block updates

object-Object opened this issue ยท 4 comments

commented

Describe the bug
We're getting sporadic server crashes with the exception java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 257. This appears to be happening in the following mixin method:

@Override
public void servercore$requiresBroadcast(ChunkHolder holder) {
this.servercore$requiresBroadcast.add(holder);
}

Log 1: https://mclo.gs/VqUt8x7
Crash 1: https://mclo.gs/PWqPTe0

Log 2: https://mclo.gs/5GNKdXj
Crash 2: https://mclo.gs/BRyJIda

Reproduce
Unfortunately I have no idea how to reproduce this crash. It appears to just happen intermittently, and I don't see anything relevant in the logs. The only thing I can think of is that both crashes were for entities in the spawn chunks, which have a pretty large amount of block entities. I'd be happy to switch to a debug jar with some extra logging if it would help troubleshoot this.

Versions
ServerCore: 1.3.3
Minecraft: 1.19.2
Quilt Loader: 0.19.0
Quilt (QFAPI/QSL): qfapi-4.0.0-beta.30_qsl-3.0.0-beta.29_fapi-0.76.0

Full modlist (it's a lot, sorry): https://github.com/HexxyCraft/modpack/tree/master/mods

commented

Closing this as the crash isn't really caused by servercore (just makes it more likely).
Relevant issue: SamsTheNerd/ducky-periphs#36

commented

Do you know if any of your mods are trying to tick their block entities (or maybe even chunks) async?

It's possible, we have a few fairly experimental mods in the pack, but off the top of my head I don't know which mod it would be.

Also - I can definitely give it a try, but the link appears to be a 404 (probably Discord's new policy of making file links temporary so you can't use them as a file server).

commented

Normally that kind of crash would suggest concurrent access to the set. Do you know if any of your mods are trying to tick their block entities (or maybe even chunks) async?

At least not all BE's are, because the ones causing the crash were ticked on the server thread (which makes it very unlikely to be their fault it crashed).

commented

I have made a quick version for debugging it, but I'm still having trouble reproducing it.
If you want to, you can give it a try. It detects when the method is called from any non-server thread and prints the stacktrace.
Do note that this will probably spam your logs full if this happens often.

https://cdn.discordapp.com/attachments/1099590675441397810/1163089807036141629/servercore-fabric-1.3.51.19.2.jar
(github wouldn't let me attach it)