When items are shot through Nether portals and removed with hopper minecarts, very occasionally this can cause a crash
The world has a chunk loader that shoots items through Nether portals to and from the Nether. When the items arrive in the other dimension, they are removed from the world using hopper minecarts placed below the Nether portal and recirculated using a simple redstone mechanism. Very rarely, this can cause a crash.
A crash report is attached which includes a stack trace.
Attachments
Comments 10
Attached are two screenshots of one of the exact locations where the crash has occurred (-38.50, 10.49, 23.51 in the Nether). One shows the block at that location (a Nether portal block). The other shows the redstone beneath, where hopper minecarts slurp up items that appear in the Nether portal and throw them back. This is a chunk loader.
A structure file containing the chunk loader is attached as "chunkloader.nbt".
To use this chunkloader:
Place a copy of the chunk loader in the Overworld and the Nether such that they will link up. Placing it in the spawn chunks is recommended.
Light both portals.
Place a stack of items in the bottom dropper for one of the structures.
If this chunkloader is allowed to run continuously, eventually it will cause a crash.
Additional note with the chunkloader: it should have three hopper minecarts placed on the rails above the three hoppers.
Every time this crash happens, it's always crashing in the same place: brx.a(SourceFile:564) in 1.16.4.
A test world is attached as MC-198373.zip. It has the chunkloaders built. I have not yet reproduced the issue in this world because it takes a while.
To start the machine, teleport to the Overworld chunk loader (a command block is provided at spawn) and flick the lever to the On position (up).
I have been unable to reproduce this so far in 1.16.5 but I am seeing messages like this in the log every now and again:
[Server thread/WARN]: Fetching packet for removed entity bcv['Air'/39580, l='ServerLevel[MC-198373]', x=81.15, y=4.00, z=164.80]
The affected entity is always "Air".
The class is listed as "bcv" which matches no known bug report.
Affects 1.16.5. Reproduced using the attached test world. Crash report is attached as 20210314.txt.
To reproduce using the test world:
Make sure all four nether portals in the test world are lit before starting. Two portals are for the player, two are for the items.
Run the world overnight. It will take a few nights but it will happen eventually.
An additional exception was thrown when stopping the server after the crash.
00:55:42.417 Exception stopping the server
java.lang.IllegalStateException: Removing entity while ticking!
at aag.i(SourceFile:942)
at aag.e(SourceFile:958)
at acu.c(SourceFile:385)
at aay.a(SourceFile:1116)
at nd.m(SourceFile:394)
at aay$$Lambda$5001/70131889.run(Unknown Source)
at aob.g(SourceFile:79)
at aay.b(SourceFile:306)
at acu.r(SourceFile:805)
at net.minecraft.server.MinecraftServer.t(SourceFile:591)
at eng.t(SourceFile:203)
at net.minecraft.server.MinecraftServer.w(SourceFile:707)
at net.minecraft.server.MinecraftServer.a(SourceFile:257)
at net.minecraft.server.MinecraftServer$$Lambda$4062/199116739.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
Since I was never able to reproduce this myself, it'd be greatly appreciated if you could check if this still applies to 1.18.1.
This is a rare crash and reproducing it is difficult. Most likely, this is a race condition where a cached value from an ArrayList's size() is no longer correct because an item has been removed from the world in the meantime. If so, replacing the cached value with an explicit call to ArrayList.size() should resolve the issue.