Question [Solved] Chunk reading errors

AkioNakao

New member
Sep 4, 2022
4
0
1
Hi,

I'm back on the plugin development train after a while (last time I coded was on 1.15).
I've downloaded a fresh jar file, started the server, logged in and moved:

Code:
[16:33:13 WARN]: Failed to read chunk [25, 33]
java.lang.IllegalArgumentException: Negative position
        at sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:813) ~[?:?]
        at net.minecraft.world.level.chunk.storage.RegionFile.getChunkDataInputStream(RegionFile.java:604) ~[paper-1.19.2.jar:git-Paper-138]
        at net.minecraft.world.level.chunk.storage.RegionFileStorage.read(RegionFileStorage.java:195) ~[?:?]
        at net.minecraft.world.level.chunk.storage.RegionFileStorage.read(RegionFileStorage.java:187) ~[?:?]
        at net.minecraft.world.level.chunk.storage.IOWorker.lambda$loadAsync$4(IOWorker.java:139) ~[paper-1.19.2.jar:git-Paper-138]
        at net.minecraft.world.level.chunk.storage.IOWorker.lambda$submitTask$13(IOWorker.java:199) ~[paper-1.19.2.jar:git-Paper-138]
        at net.minecraft.util.thread.StrictQueue$IntRunnable.run(StrictQueue.java:80) ~[?:?]
        at net.minecraft.util.thread.ProcessorMailbox.pollTask(ProcessorMailbox.java:87) ~[?:?]
        at net.minecraft.util.thread.ProcessorMailbox.pollUntil(ProcessorMailbox.java:141) ~[?:?]
        at net.minecraft.util.thread.ProcessorMailbox.run(ProcessorMailbox.java:96) ~[?:?]
        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) ~[?:?]
[16:33:13 ERROR]: Failed to read chunk [25, 33]
java.util.concurrent.CompletionException: java.lang.IllegalArgumentException: Negative position
        at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:332) ~[?:?]
        at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:347) ~[?:?]
        at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:636) ~[?:?]
        at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?]
        at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:2162) ~[?:?]
        at com.mojang.datafixers.util.Either$Right.ifRight(Either.java:109) ~[paper-1.19.2.jar:?]
        at net.minecraft.util.thread.ProcessorHandle.lambda$askEither$0(ProcessorHandle.java:28) ~[?:?]
        at net.minecraft.util.thread.ProcessorHandle$1.tell(ProcessorHandle.java:43) ~[?:?]
        at net.minecraft.world.level.chunk.storage.IOWorker.lambda$submitTask$13(IOWorker.java:199) ~[paper-1.19.2.jar:git-Paper-138]
        at net.minecraft.util.thread.StrictQueue$IntRunnable.run(StrictQueue.java:80) ~[?:?]
        at net.minecraft.util.thread.ProcessorMailbox.pollTask(ProcessorMailbox.java:87) ~[?:?]
        at net.minecraft.util.thread.ProcessorMailbox.pollUntil(ProcessorMailbox.java:141) ~[?:?]
        at net.minecraft.util.thread.ProcessorMailbox.run(ProcessorMailbox.java:96) ~[?:?]
        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: java.lang.IllegalArgumentException: Negative position
        at sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:813) ~[?:?]
        at net.minecraft.world.level.chunk.storage.RegionFile.getChunkDataInputStream(RegionFile.java:604) ~[paper-1.19.2.jar:git-Paper-138]
        at net.minecraft.world.level.chunk.storage.RegionFileStorage.read(RegionFileStorage.java:195) ~[?:?]
        at net.minecraft.world.level.chunk.storage.RegionFileStorage.read(RegionFileStorage.java:187) ~[?:?]
        at net.minecraft.world.level.chunk.storage.IOWorker.lambda$loadAsync$4(IOWorker.java:139) ~[paper-1.19.2.jar:git-Paper-138]
        ... 8 more
[16:33:13 ERROR]: Chunk [25, 30] header is truncated: expected 430080 but read 0
[16:33:14 ERROR]: Chunk [25, 44] header is truncated: expected 344064 but read 0
[16:33:14 ERROR]: Chunk [25, 45] header is truncated: expected 544768 but read 0


PaperMC Version1.19.2
PaperMC Build138
EnvironmentRunning on WSL - Windows 11

I do not have any plugin installed, and it's a clean world (even removed the world folders just to be sure)

The server is still working fine with no visible issues with the map generation, except it's a bit slower than usual
 
Logs
https://pastebin.com/xUZ1dZ20
Timings
https://timings.aikar.co/dev/?id=fc3be1fcdbc040a083fb9fc41eaad2dd
Version Output
This server is running Paper version git-Paper-138 (MC: 1.19.2) (Implementing API version 1.19.2-R0.1-SNAPSHOT) (Git: 09904fd)
You are running the latest version

AkioNakao

New member
Sep 4, 2022
4
0
1
I should add that this is not happening when I run the server on W11. It only happen with WSL

Upon joining the server running on W11, I'm greeted by this (a lot more in the console, for a lot of chunks):

Code:
[17:03:28 ERROR]: Detected invalid header for regionfile D:\Documents\Jetbrains\papermc-plugin-starter\.papermc\.\world\poi\r.-2.-1.mca! Cannot recalculate, removing local chunk (23,18) from header
[17:03:28 WARN]: Region file .\world\poi\r.-2.-1.mca has an invalid sector at index: 600; size has to be > 0
[17:03:28 ERROR]: Detected invalid header for regionfile D:\Documents\Jetbrains\papermc-plugin-starter\.papermc\.\world\poi\r.-2.-1.mca! Cannot recalculate, removing local chunk (24,18) from header
[17:03:28 WARN]: Region file .\world\poi\r.-2.-1.mca has an invalid sector at index: 601; sector 1310728 is out of bounds
[17:03:28 ERROR]: Detected invalid header for regionfile D:\Documents\Jetbrains\papermc-plugin-starter\.papermc\.\world\poi\r.-2.-1.mca! Cannot recalculate, removing local chunk (25,18) from header
[17:03:28 WARN]: Region file .\world\poi\r.-2.-1.mca has an invalid sector at index: 602; sector 524429 is out of bounds
[17:03:28 ERROR]: Detected invalid header for regionfile D:\Documents\Jetbrains\papermc-plugin-starter\.papermc\.\world\poi\r.-2.-1.mca! Cannot recalculate, removing local chunk (26,18) from header
[17:03:28 WARN]: Region file .\world\poi\r.-2.-1.mca has an invalid sector at index: 603; sector 2970371 is out of bounds
[17:03:28 ERROR]: Detected invalid header for regionfile D:\Documents\Jetbrains\papermc-plugin-starter\.papermc\.\world\poi\r.-2.-1.mca! Cannot recalculate, removing local chunk (27,18) from header
[17:03:28 WARN]: Region file .\world\poi\r.-2.-1.mca has an invalid sector at index: 604; sector 7649370 is out of bounds
[17:03:28 ERROR]: Detected invalid header for regionfile D:\Documents\Jetbrains\papermc-plugin-starter\.papermc\.\world\poi\r.-2.-1.mca! Cannot recalculate, removing local chunk (28,18) from header
[17:03:28 WARN]: Region file .\world\poi\r.-2.-1.mca has an invalid sector at index: 605; sector 230 is out of bounds
[17:03:28 ERROR]: Detected invalid header for regionfile D:\Documents\Jetbrains\papermc-plugin-starter\.papermc\.\world\poi\r.-2.-1.mca! Cannot recalculate, removing local chunk (29,18) from header
[17:03:28 WARN]: Region file .\world\poi\r.-2.-1.mca has an invalid sector at index: 606; size has to be > 0
[17:03:28 ERROR]: Detected invalid header for regionfile D:\Documents\Jetbrains\papermc-plugin-starter\.papermc\.\world\poi\r.-2.-1.mca! Cannot recalculate, removing local chunk (30,18) from header
[17:03:28 WARN]: Region file .\world\poi\r.-2.-1.mca has an invalid sector at index: 610; size has to be > 0
 

AkioNakao

New member
Sep 4, 2022
4
0
1
Thank you for the warning. I've changed my way of doing things. Instead of having everything on W11 being accessed by WSL, the whole server is now on the WSL part with the "plugins" folder being a symlink to my compilation output directory.

No chunk errors and the plugin loads just fine.