mojira.dev
MC-115237

World and/or player data gets corrupted if a server is suddenly shut down

The bug

If an integrated / multiplayer server gets forcibly or unexpectedly closed (due to a crash / PC shutdown / OS update - Windows in particular) the world data gets corrupted.

Potential corruptions / damage:

  • Unreadable region files (chunk, block, entity data)

  • Level.dat (general data about the world and player data in singleplayer)

  • Unrecoverable player data in multiplayer (resulting in complete overwrite of the files at the next start)

  • Chunk saving errors when the server tries to save the world after the corruption

 

[14:06:37] [Server thread/WARN]: Failed to load player data for VideoklipBG
[14:06:37] [Server thread/INFO]: VideoklipBG[/192.168.0.180:50321] logged in with entity id 196 at (101.5, 67.0, -117.5)
[14:06:37] [Server thread/INFO]: VideoklipBG joined the game
[14:06:54] [File IO Thread/ERROR]: Failed to save chunk
java.lang.IndexOutOfBoundsException: Index: 811, Size: 805
        at java.util.ArrayList.rangeCheck(Unknown Source) ~[?:1.8.0_181]
        at java.util.ArrayList.set(Unknown Source) ~[?:1.8.0_181]
        at bnw.a(SourceFile:304) ~[server_18w31a.jar:?]
        at bnw$a.close(SourceFile:279) ~[server_18w31a.jar:?]
        at java.util.zip.DeflaterOutputStream.close(Unknown Source) ~[?:1.8.0_181]
        at java.io.FilterOutputStream.close(Unknown Source) ~[?:1.8.0_181]
        at java.io.FilterOutputStream.close(Unknown Source) ~[?:1.8.0_181]
        at bns.a(SourceFile:270) [server_18w31a.jar:?]
        at cdt.c(SourceFile:44) [server_18w31a.jar:?]
        at cdt.run(SourceFile:35) [server_18w31a.jar:?]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_181]
[14:07:25] [Server thread/INFO]: [VideoklipBG: Saved the game]
[14:07:28] [Server thread/ERROR]: Failed to save chunk
java.lang.IndexOutOfBoundsException: Index: 807, Size: 805
        at java.util.ArrayList.rangeCheck(Unknown Source) ~[?:1.8.0_181]
        at java.util.ArrayList.set(Unknown Source) ~[?:1.8.0_181]
        at bnw.a(SourceFile:304) ~[server_18w31a.jar:?]
        at bnw$a.close(SourceFile:279) ~[server_18w31a.jar:?]
        at java.util.zip.DeflaterOutputStream.close(Unknown Source) ~[?:1.8.0_181]
        at java.io.FilterOutputStream.close(Unknown Source) ~[?:1.8.0_181]
        at java.io.FilterOutputStream.close(Unknown Source) ~[?:1.8.0_181]
        at bns.a(SourceFile:270) ~[server_18w31a.jar:?]
        at bns.b(SourceFile:296) ~[server_18w31a.jar:?]
        at td.c(SourceFile:235) ~[server_18w31a.jar:?]
        at te.u(SourceFile:746) ~[server_18w31a.jar:?]
        at rk.a(SourceFile:60) ~[server_18w31a.jar:?]
        at rk.a(SourceFile:39) ~[server_18w31a.jar:?]
        at rk.a(SourceFile:25) ~[server_18w31a.jar:?]
        at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:132) ~[server_18w31a.jar:?]
        at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:72) ~[server_18w31a.jar:?]
        at bv.a(SourceFile:205) ~[server_18w31a.jar:?]
        at ud.c(SourceFile:1075) ~[server_18w31a.jar:?]
        at ud.a(SourceFile:1062) ~[server_18w31a.jar:?]
        at mi.a(SourceFile:37) ~[server_18w31a.jar:?]
        at mi.a(SourceFile:9) ~[server_18w31a.jar:?]
        at iy.a(SourceFile:10) ~[server_18w31a.jar:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_181]
        at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_181]
        at k.a(SourceFile:199) [server_18w31a.jar:?]
        at net.minecraft.server.MinecraftServer.b(SourceFile:726) [server_18w31a.jar:?]
        at sp.b(SourceFile:360) [server_18w31a.jar:?]
        at net.minecraft.server.MinecraftServer.a(SourceFile:681) [server_18w31a.jar:?]
        at net.minecraft.server.MinecraftServer.run(SourceFile:584) [server_18w31a.jar:?]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_181]
[14:07:28] [Server thread/ERROR]: Failed to save chunk
java.lang.IndexOutOfBoundsException: Index: 811, Size: 805
        at java.util.ArrayList.rangeCheck(Unknown Source) ~[?:1.8.0_181]
        at java.util.ArrayList.set(Unknown Source) ~[?:1.8.0_181]
        at bnw.a(SourceFile:304) ~[server_18w31a.jar:?]
        at bnw$a.close(SourceFile:279) ~[server_18w31a.jar:?]
        at java.util.zip.DeflaterOutputStream.close(Unknown Source) ~[?:1.8.0_181]
        at java.io.FilterOutputStream.close(Unknown Source) ~[?:1.8.0_181]
        at java.io.FilterOutputStream.close(Unknown Source) ~[?:1.8.0_181]
        at bns.a(SourceFile:270) ~[server_18w31a.jar:?]
        at bns.b(SourceFile:296) ~[server_18w31a.jar:?]
        at td.c(SourceFile:235) ~[server_18w31a.jar:?]
        at te.u(SourceFile:746) ~[server_18w31a.jar:?]
        at rk.a(SourceFile:60) ~[server_18w31a.jar:?]
        at rk.a(SourceFile:39) ~[server_18w31a.jar:?]
        at rk.a(SourceFile:25) ~[server_18w31a.jar:?]
        at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:132) ~[server_18w31a.jar:?]
        at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:72) ~[server_18w31a.jar:?]
        at bv.a(SourceFile:205) ~[server_18w31a.jar:?]
        at ud.c(SourceFile:1075) ~[server_18w31a.jar:?]
        at ud.a(SourceFile:1062) ~[server_18w31a.jar:?]
        at mi.a(SourceFile:37) ~[server_18w31a.jar:?]
        at mi.a(SourceFile:9) ~[server_18w31a.jar:?]
        at iy.a(SourceFile:10) ~[server_18w31a.jar:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_181]
        at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_181]
        at k.a(SourceFile:199) [server_18w31a.jar:?]
        at net.minecraft.server.MinecraftServer.b(SourceFile:726) [server_18w31a.jar:?]
        at sp.b(SourceFile:360) [server_18w31a.jar:?]
        at net.minecraft.server.MinecraftServer.a(SourceFile:681) [server_18w31a.jar:?]
        at net.minecraft.server.MinecraftServer.run(SourceFile:584) [server_18w31a.jar:?]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_181]

 

Linked issues

MC-142879 World does not appear in the world selection menu Resolved MC-144003 World completely missing (possible deleted) after visual errors Resolved MC-145933 worlds get deleted after a random crash Resolved MC-148691 World no longer appearing in my World's List after some visual issues. Resolved MC-154380 Worlds in saves folder not showing up in World List Resolved

Comments 17

If you close an application without giving it any time to finish what it's doing (e. g. power outage, kill via task manager), it's inevitable that things will break. In your case, it seems that Minecraft was in the middle of writing the <player>.dat file when you force closed it. The next time you started it, Minecraft detected that the file was invalid and ignored it, generating a new blank one instead.

There are ways of coding that prevent corruption of files in such manner.

@unknown Do you have any objections if I change myself to the reporter, to keep it more up to date? (I experience this every day due to windows attempting to update every time.)

[Mod] FVbico (Steven Verberne) Oh, I thought this was an old, closed issue and I haven't updated / changed anything here, beacause it was tagged as invalid? I have nothing against that, go ahead if you want to own and update this ticket.

Actually I have created it, because a long time ago some the 1.8 verisons (1.8 - 1.8.9) and behind (1.7.10 and previous) when the Server is force-closed, killed or the process is tereminaed in some way (OS crash, Machine power off due to power outage, etc.) all the files were fine, nothing corrupted, rolled-back couple seconds, everything was saved how it's supposed to be.

From 1.9 + (I think) almost all data is corrupted in some way and regenerated on the next start. (Spawn chunks, Last loaded chunks, All player data, Stats, Info about the other dimensions and structures and many more, including "level.dat")

It was resolved as invalid for a wrong reason; I reopened it when I found it.

7 more comments

Sometimes this even reset my statistics

I am at a complete loss as what to do. Last night I was playing Minecraft on Survival Peaceful Mode when we lost our electricity. All the power went out in our town and was not restored for several hours later. Today, when I logged in Minecraft, I went to my world (still listed as usual) and started puttering around in my castle and front gardens. I went to the back to bring stuff to the local village which is in sight and everything was messed up. Holes are everywhere, the homes of the villagers and the villagers themselves are ruined or missing, red soil from the badlands suddenly showed up in my desert, blotches of the landscape is all messed up and moved around. My world is ruined. After all my hard work and time devoted to it. I don't know how to fix this. Please help!

It already happened. It cannot be fixed. I would say to backup your world daily in the future. So if anything is lost, it is just a day.

Can confirm for Minecraft 1.20

Can confirm for Minecraft Java 1.21.5

VideoklipBG

(Unassigned)

Confirmed

Platform

Important

Save Data

Minecraft 1.11.2, Minecraft 17w06a, Minecraft 17w13a, Minecraft 17w13b, Minecraft 1.12.2, ..., 1.19.2, 1.19.3, 1.20, 1.20.1, 1.20.4

Retrieved