Affects 1.21.5-pre-3, 1.21.8
When running a server for too long, the game crashes with an ArrayIndexOutOfBounds
error. This happens because MinecraftServer.ticks
(yarn, linkie won’t find it in MojMaps for some reason) overflows, then the array that keeps track of tick times is accessed with index ticks % 100
, which is -48
.
To reproduce:
Start a server, preferably a void world with all the performance gains you can find (eg random tick speed at 0)
Run
/tick sprint 10000000d
or some other large numberWait
int j = this.ticks % 100;
this.recentTickTimesNanos -= this.tickTimes[j];
Environment
Ubuntu dedicated server (should work in singleplayer too)
Attachments
Comments 8
I had a server set on this tick sprint with the maximum tick rate as well, but had no crash.
Are you able to attach the crash report please?
Oh geez I did the math it’ll be about 3 years before it crashes at 1 million tps. I suppose this’ll be closed as invalid or won’t fix then, I’ll make a mod to fix it for my use case.
---- Minecraft Crash Report ----
// Surprise! Haha. Well, this is awkward.
Time: 2025-03-21 17:40:23
Description: Exception in server tick loop
java.lang.ArrayIndexOutOfBoundsException: Index -48 out of bounds for length 100
at net.minecraft.server.MinecraftServer.a(SourceFile:962)
at net.minecraft.server.MinecraftServer.y(SourceFile:706)
at net.minecraft.server.MinecraftServer.a(SourceFile:290)
at java.base/java.lang.Thread.run(Thread.java:1583)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- System Details --
Details:
Minecraft Version: 1.21.5 Release Candidate 1
Minecraft Version ID: 1.21.5-rc1
Operating System: Linux (aarch64) version 5.15.0-1068-oracle
Java Version: 21.0.6, Ubuntu
Java VM Version: OpenJDK 64-Bit Server VM (mixed mode, sharing), Ubuntu
Memory: 148808024 bytes (141 MiB) / 695205888 bytes (663 MiB) up to 2147483648 bytes (2048 MiB)
CPUs: 4
Processor Vendor: ARM
Processor Name: Neoverse-N1
Identifier: ARM Family 8 Model 0xd0c Stepping r3p1
Microarchitecture: unknown
Frequency (GHz): -0.00
Number of physical packages: 1
Number of physical CPUs: 4
Number of logical CPUs: 4
Graphics card #0 name: Virtio GPU
Graphics card #0 vendor: Red Hat, Inc.
Graphics card #0 VRAM (MiB): 0.00
Graphics card #0 deviceId: unknown
Graphics card #0 versionInfo: version: 01
Virtual memory max (MiB): 11994.52
Virtual memory used (MiB): 5226.93
Swap memory total (MiB): 0.00
Swap memory used (MiB): 0.00
Space in storage for jna.tmpdir (MiB): <path not set>
Space in storage for org.lwjgl.system.SharedLibraryExtractPath (MiB): <path not set>
Space in storage for io.netty.native.workdir (MiB): <path not set>
Space in storage for java.io.tmpdir (MiB): available: 33113.47, total: 46041.01
Space in storage for workdir (MiB): available: 33113.47, total: 46041.01
JVM Flags: 1 total; -Xmx2048M
Server Running: true
Player Count: 0 / 20; []
Active Data Packs: vanilla
Available Data Packs: minecart_improvements, redstone_experiments, trade_rebalance, vanilla
Enabled Feature Flags: minecraft:vanilla
World Generation: Stable
World Seed: 8466797366112192443
Suppressed Exceptions: ~~NONE~~
Is Modded: Probably not. Server jar signature and brand is untouched
Type: Dedicated Server (map_server.txt)
[media]
I’ve been informed that
ticks
in yarn istickCount
in MojMap