Paper icon indicating copy to clipboard operation
Paper copied to clipboard

[1.18] Teleporting results in exception spam

Open DarkEyeDragon opened this issue 5 years ago • 10 comments

Stack trace

[16:41:25 FATAL]: Error executing task on Chunk source main thread executor for minecraft:overworld
net.minecraft.ReportedException: Exception generating new chunk
        at net.minecraft.server.level.ChunkMap.lambda$scheduleChunkGeneration$34(ChunkMap.java:1260) ~[paper-1.18.jar:git-Paper-25]
        at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:149) ~[?:?]
        at net.minecraft.server.level.ServerChunkCache$MainThreadExecutor.doRunTask(ServerChunkCache.java:1231) ~[?:?]
        at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:122) ~[?:?]
        at net.minecraft.server.level.ServerChunkCache$MainThreadExecutor.pollTask(ServerChunkCache.java:1243) ~[?:?]
        at net.minecraft.server.level.ServerChunkCache.pollTask(ServerChunkCache.java:831) ~[?:?]
        at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1401) ~[paper-1.18.jar:git-Paper-25]
        at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1384) ~[paper-1.18.jar:git-Paper-25]
        at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:132) ~[?:?]
        at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1362) ~[paper-1.18.jar:git-Paper-25]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1268) ~[paper-1.18.jar:git-Paper-25]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:317) ~[paper-1.18.jar:git-Paper-25]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.ArrayIndexOutOfBoundsException
[16:41:25 INFO]: [STDOUT] [net.minecraft.CrashReport] Negative index in crash report handler (0/12)

Plugin and Datapack List

[16:44:09 INFO]: Plugins (1): RandomTeleport

Actions to reproduce (if known)

Add https://ci.darkeyedragon.me/job/Random%20Teleport/123/ to plugins dir start server

/rtp

watch the carnage unleash

Paper version

[16:44:38 INFO]: This server is running Paper version git-Paper-25 (MC: 1.18) (Implementing API version 1.18-R0.1-SNAPSHOT) (Git: 1f5b013)

Other

Regular teleports work fine. So it's probably something to do with how i handle teleportation

Relevant source: https://github.com/DarkEyeDragon/RandomTeleport/blob/6b7a37401cb75840392e2e6c8806d2cdb3e07b67/Spigot/src/main/java/me/darkeyedragon/randomtp/world/PlayerSpigot.java#L63

It uses paperlib for teleporting.

Edit: It happens on Spigot too.

DarkEyeDragon avatar Dec 03 '21 15:12 DarkEyeDragon

After doing some further testing it seems to only happen for large locations. Anything in the 100000+ range. So this might be related to overflow of some sorts?

DarkEyeDragon avatar Dec 26 '21 23:12 DarkEyeDragon

Update: After some painstaking debugging i've come to the conclution it seems to be related to either ChunkSnapshots or Chunk#getChunkAtAsync() but since this also happens on spigot and when doing it sync my guess is with the ChunkSnapshot system? (I did not test without chunk snapshots since that would require quite a bit of refactoring)

Relevant code: https://github.com/DarkEyeDragon/RandomTeleport/blob/dev/Common/src/main/java/me/darkeyedragon/randomtp/common/teleport/BasicTeleportHandler.java#L114 This line will result in the chunk exception spam provided in the original post However when not doing the async chunk logic before teleporting it works perfectly fine.

// So remove the async chunk call and just execute the code sync
//location.getWorld().getChunkAtAsync(location.getWorld(), location.getBlockX(), location.getBlockZ()).thenAccept();
LocationSearcher baseLocationSearcher = LocationSearcherFactory.getLocationSearcher(property.getWorld(), plugin);
if (!baseLocationSearcher.isSafe(location)) {
    toRandomLocation(property);
    return;
}
...

The getChunkAtAsync wrapper:

@Override
public CompletableFuture<RandomChunkSnapshot> getChunkAtAsync(RandomWorld world, int x, int z) {
    World regWorld = WorldUtil.toWorld(world);
    if (PaperLib.isPaper()) {
        return regWorld.getChunkAtAsync(x, z, true, true).thenApply(chunk -> new SpigotChunkSnapshot(chunk.getChunkSnapshot(true, true, false)));
    }
    return PaperLib.getChunkAtAsync(regWorld, x, z, true, true).thenApply(chunk -> new SpigotChunkSnapshot(chunk.getChunkSnapshot(true, true, false)));
}

Basically does the exact same as paper but just abstracted

DarkEyeDragon avatar Dec 29 '21 17:12 DarkEyeDragon

[13:27:23 WARN]: java.lang.ArrayIndexOutOfBoundsException: Index -20971206 out of bounds for length 315
[13:27:23 WARN]: 	at net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer.getAquiferStatus(Aquifer.java:478)
[13:27:23 WARN]: 	at net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer.computeSubstance(Aquifer.java:283)
[13:27:23 WARN]: 	at net.minecraft.world.level.levelgen.NoiseSampler.lambda$makeBaseNoiseFiller$10(NoiseSampler.java:451)
[13:27:23 WARN]: 	at net.minecraft.world.level.levelgen.NoiseChunk.updateNoiseAndGenerateBaseState(NoiseChunk.java:181)
[13:27:23 WARN]: 	at net.minecraft.world.level.levelgen.material.MaterialRuleList.apply(MaterialRuleList.java:20)
[13:27:23 WARN]: 	at net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator.iterateNoiseColumn(NoiseBasedChunkGenerator.java:213)
[13:27:23 WARN]: 	at net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator.getBaseColumn(NoiseBasedChunkGenerator.java:181)
[13:27:23 WARN]: 	at net.minecraft.world.level.levelgen.structure.NetherFossilFeature.pieceGeneratorSupplier(NetherFossilFeature.java:40)
[13:27:23 WARN]: 	at net.minecraft.world.level.levelgen.feature.StructureFeature.generate(StructureFeature.java:234)
[13:27:23 WARN]: 	at net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature.generate(ConfiguredStructureFeature.java:36)
[13:27:23 WARN]: 	at net.minecraft.world.level.chunk.ChunkGenerator.createStructures(ChunkGenerator.java:492)
[13:27:23 WARN]: 	at net.minecraft.world.level.chunk.ChunkStatus.lambda$static$2(ChunkStatus.java:51)
[13:27:23 WARN]: 	at net.minecraft.world.level.chunk.ChunkStatus.generate(ChunkStatus.java:273)
[13:27:23 WARN]: 	at net.minecraft.server.level.ChunkMap.lambda$scheduleChunkGeneration$35(ChunkMap.java:1205)
[13:27:23 WARN]: 	at com.mojang.datafixers.util.Either$Left.map(Either.java:38)
[13:27:23 WARN]: 	at net.minecraft.server.level.ChunkMap.lambda$scheduleChunkGeneration$37(ChunkMap.java:1203)
[13:27:23 WARN]: 	at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1150)
[13:27:23 WARN]: 	at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482)
[13:27:23 WARN]: 	at net.minecraft.server.level.ChunkTaskPriorityQueueSorter.lambda$message$1(ChunkTaskPriorityQueueSorter.java:58)
[13:27:23 WARN]: 	at net.minecraft.util.thread.ProcessorMailbox.pollTask(ProcessorMailbox.java:91)
[13:27:23 WARN]: 	at net.minecraft.util.thread.ProcessorMailbox.pollUntil(ProcessorMailbox.java:146)
[13:27:23 WARN]: 	at net.minecraft.util.thread.ProcessorMailbox.run(ProcessorMailbox.java:102)
[13:27:23 WARN]: 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
[13:27:23 WARN]: 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[13:27:23 WARN]: 	at java.base/java.lang.Thread.run(Thread.java:833)
[13:27:23 FATAL]: Error executing task on Chunk source main thread executor for minecraft:overworld

Has to do with chunk generation. Here is the stack trace for the AOOB, makes sense it doesn't like these large values as it seems to be packing the coordinates into a long.

Owen1212055 avatar Dec 29 '21 18:12 Owen1212055

NoiseBasedAquifer takes the x, y,z coords from some context and tosses it into a thing, I don't see how there would be any difference between any form of loadin that chunk up bar chance of whatever stuff the seed puts there, etc

electronicboy avatar Dec 29 '21 18:12 electronicboy

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Feb 27 '22 18:02 stale[bot]

I am also getting crashes

Caused by: java.lang.ArrayIndexOutOfBoundsException: Index -536870611 out of bounds for length 315

[18:25:23 ERROR]: Exception stopping the server java.util.concurrent.CompletionException: net.minecraft.ReportedException: Exception generating new chunk at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315) ~[?:?] at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320) ~[?:?] at java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1159) ~[?:?] at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?] at net.minecraft.server.level.ChunkTaskPriorityQueueSorter.lambda$message$1(ChunkTaskPriorityQueueSorter.java:58) ~[?:?] at net.minecraft.util.thread.ProcessorMailbox.pollTask(ProcessorMailbox.java:91) ~[?:?] at net.minecraft.util.thread.ProcessorMailbox.pollUntil(ProcessorMailbox.java:146) ~[?:?] at net.minecraft.util.thread.ProcessorMailbox.run(ProcessorMailbox.java:102) ~[?:?] 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:833) ~[?:?] Caused by: net.minecraft.ReportedException: Exception generating new chunk at net.minecraft.server.level.ChunkTracker.lambda$scheduleChunkGeneration$35(ChunkTracker.java:1249) ~[?:?] at com.mojang.datafixers.util.Either$Left.map(Either.java:38) ~[paper-1.18.1.jar:?] at net.minecraft.server.level.ChunkTracker.lambda$scheduleChunkGeneration$37(ChunkTracker.java:1230) ~[?:?] at java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1150) ~[?:?] ... 8 more Caused by: java.lang.ArrayIndexOutOfBoundsException: Index -536870611 out of bounds for length 315 at net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer.getAquiferStatus(Aquifer.java:478) ~[?:?] at net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer.computeSubstance(Aquifer.java:283) ~[?:?] at net.minecraft.world.level.levelgen.NoiseSampler.lambda$makeBaseNoiseFiller$10(NoiseSampler.java:451) ~[paper-1.18.1.jar:git-Paper-216] at net.minecraft.world.level.levelgen.NoiseChunk.updateNoiseAndGenerateBaseState(NoiseChunk.java:181) ~[paper-1.18.1.jar:git-Paper-216] at net.minecraft.world.level.levelgen.material.MaterialRuleList.apply(MaterialRuleList.java:20) ~[paper-1.18.1.jar:git-Paper-216] at net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator.iterateNoiseColumn(NoiseBasedChunkGenerator.java:213) ~[?:?] at net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator.getBaseColumn(NoiseBasedChunkGenerator.java:181) ~[?:?] at net.minecraft.world.level.levelgen.structure.NetherFossilFeature.pieceGeneratorSupplier(NetherFossilFeature.java:40) ~[?:?] at net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature.generate(ConfiguredStructureFeature.java:234) ~[?:?] at net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature.generate(ConfiguredStructureFeature.java:36) ~[?:?] at net.minecraft.world.level.chunk.ChunkGenerator.createStructures(ChunkGenerator.java:492) ~[paper-1.18.1.jar:git-Paper-216] at net.minecraft.world.level.chunk.ChunkStatus.lambda$static$2(ChunkStatus.java:51) ~[paper-1.18.1.jar:git-Paper-216] at net.minecraft.world.level.chunk.ChunkStatus.generate(ChunkStatus.java:273) ~[paper-1.18.1.jar:git-Paper-216] at net.minecraft.server.level.ChunkTracker.lambda$scheduleChunkGeneration$35(ChunkTracker.java:1232) ~[?:?] at com.mojang.datafixers.util.Either$Left.map(Either.java:38) ~[paper-1.18.1.jar:?] at net.minecraft.server.level.ChunkTracker.lambda$scheduleChunkGeneration$37(ChunkTracker.java:1230) ~[?:?] at java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1150) ~[?:?] ... 8 more

SnickoDeadMC avatar Mar 02 '22 01:03 SnickoDeadMC

Here's some updated errors before the crash report

https://pastebin.com/9SMaxsgd

SnickoDeadMC avatar Mar 20 '22 09:03 SnickoDeadMC

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 30 '22 21:05 stale[bot]

This can probably be closed as the reason for this is generally accessing far away chunks, which is now properly logged when that might be occurring.

Owen1212055 avatar Jul 30 '22 04:07 Owen1212055

Got same problem, world border to 30.000 blocks https://i.imgur.com/Q89QfXJ.png

Crash logs https://pastebin.com/Jgn9eCW7

I'm pretty sure that noone going 100k blocks away

LordManzana avatar Aug 24 '22 13:08 LordManzana