mojira.dev
MC-55099

save-all fails to ensure player data is saved, lost after power failure

I have a server running locally and a storm was coming in. I heard a clap of thunder and typed /save-all from my client. Literally 5 seconds later, the power failed! My world is in perfect condition, but when I got back into the game, I was naked at my default spawn point. The server console had this to say upon startup:

May 12, 2014 3:52:10 PM io.netty.util.internal.PlatformDependent <clinit>
INFO: Your platform does not provide complete low-level API for accessing direct buffers reliably. Unless explicitly requested, heap buffer will always be preferred to avoid potential system unstability.
[15:52:15] [Server thread/INFO]: Starting minecraft server version 1.7.9
[15:52:15] [Server thread/INFO]: Loading properties
[15:52:16] [Server thread/INFO]: Default game type: SURVIVAL
[15:52:16] [Server thread/INFO]: Generating keypair
[15:52:16] [Server thread/INFO]: Starting Minecraft server on *:25565
[15:52:17] [Server thread/INFO]: Preparing level "world"
[15:52:17] [Server thread/ERROR]: Exception reading /home/daniel/.minecraft/server/b/world/level.dat
java.io.EOFException
        at java.util.zip.GZIPInputStream.readUByte(GZIPInputStream.java:224) ~[?:1.6.0_27]
        at java.util.zip.GZIPInputStream.readUShort(GZIPInputStream.java:214) ~[?:1.6.0_27]
        at java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:153) ~[?:1.6.0_27]
        at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:75) ~[?:1.6.0_27]
        at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:85) ~[?:1.6.0_27]
        at du.a(SourceFile:13) ~[minecraft_server.1.7.9.jar:?]
        at ayq.c(SourceFile:56) [minecraft_server.1.7.9.jar:?]
        at aym.b(SourceFile:88) [minecraft_server.1.7.9.jar:?]
        at net.minecraft.server.MinecraftServer.a(SourceFile:131) [minecraft_server.1.7.9.jar:?]
        at net.minecraft.server.MinecraftServer.a(SourceFile:173) [minecraft_server.1.7.9.jar:?]
        at ls.e(SourceFile:196) [minecraft_server.1.7.9.jar:?]
        at net.minecraft.server.MinecraftServer.run(SourceFile:339) [minecraft_server.1.7.9.jar:?]
        at li.run(SourceFile:628) [minecraft_server.1.7.9.jar:?]
java.io.EOFException
        at java.util.zip.GZIPInputStream.readUByte(GZIPInputStream.java:224)
        at java.util.zip.GZIPInputStream.readUShort(GZIPInputStream.java:214)
        at java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:153)
        at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:75)
        at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:85)
        at du.a(SourceFile:13)
        at ayp.d(SourceFile:84)
        at net.minecraft.server.MinecraftServer.a(SourceFile:182)
        at ls.e(SourceFile:196)
        at net.minecraft.server.MinecraftServer.run(SourceFile:339)
        at li.run(SourceFile:628)
java.io.EOFException
        at java.util.zip.GZIPInputStream.readUByte(GZIPInputStream.java:224)
        at java.util.zip.GZIPInputStream.readUShort(GZIPInputStream.java:214)
        at java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:153)                                                                                                                                   
        at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:75)                                                                                                                                        
        at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:85)                                                                                                                                        
        at du.a(SourceFile:13)                                                                                                                                                                                  
        at ayp.d(SourceFile:84)                                                                                                                                                                                 
        at aha.<init>(SourceFile:171)                                                                                                                                                                           
        at ms.<init>(SourceFile:69)                                                                                                                                                                             
        at net.minecraft.server.MinecraftServer.a(SourceFile:203)                                                                                                                                               
        at ls.e(SourceFile:196)                                                                                                                                                                                 
        at net.minecraft.server.MinecraftServer.run(SourceFile:339)                                                                                                                                             
        at li.run(SourceFile:628)                                                                                                                                                                               
java.io.EOFException                                                                                                                                                                                            
        at java.util.zip.GZIPInputStream.readUByte(GZIPInputStream.java:224)                                                                                                                                    
        at java.util.zip.GZIPInputStream.readUShort(GZIPInputStream.java:214)                                                                                                                                   
        at java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:153)                                                                                                                                   
        at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:75)                                                                                                                                        
        at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:85)                                                                                                                                        
        at du.a(SourceFile:13)                                                                                                                                                                                  
        at ayp.d(SourceFile:84)                                                                                                                                                                                 
        at aha.<init>(SourceFile:171)                                                                                                                                                                           
        at ms.<init>(SourceFile:69)                                                                                                                                                                             
        at ml.<init>(SourceFile:10)                                                                                                                                                                             
        at net.minecraft.server.MinecraftServer.a(SourceFile:206)                                                                                                                                               
        at ls.e(SourceFile:196)                                                                                                                                                                                 
        at net.minecraft.server.MinecraftServer.run(SourceFile:339)                                                                                                                                             
        at li.run(SourceFile:628)                                                                                                                                                                               
java.io.EOFException                                                                                                                                                                                            
        at java.util.zip.GZIPInputStream.readUByte(GZIPInputStream.java:224)
        at java.util.zip.GZIPInputStream.readUShort(GZIPInputStream.java:214)
        at java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:153)
        at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:75)
        at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:85)
        at du.a(SourceFile:13)
        at ayp.d(SourceFile:84)
        at aha.<init>(SourceFile:171)
        at ms.<init>(SourceFile:69)
        at ml.<init>(SourceFile:10)
        at net.minecraft.server.MinecraftServer.a(SourceFile:206)
        at ls.e(SourceFile:196)
        at net.minecraft.server.MinecraftServer.run(SourceFile:339)
        at li.run(SourceFile:628)
[15:52:17] [Server thread/INFO]: Preparing start region for level 0
[15:52:18] [Server thread/INFO]: Preparing spawn area: 3%
[15:52:19] [Server thread/INFO]: Preparing spawn area: 41%
[15:52:20] [Server thread/INFO]: Preparing spawn area: 97%
[15:52:20] [Server thread/INFO]: Done (3.435s)! For help, type "help" or "?"
[15:53:13] [User Authenticator #1/INFO]: UUID of player pirateswithfleas is ddc34705-350e-4cdd-b33c-6cde9eedf03e
[15:53:13] [Server thread/WARN]: Failed to load player data for pirateswithfleas
[15:53:13] [Server thread/INFO]: pirateswithfleas[/192.168.1.4:45126] logged in with entity id 321 at (-223.5, 69.0, 251.5)
[15:53:13] [Server thread/INFO]: pirateswithfleas joined the game

So I guess I expected save-all to ensure that my world & player data were saved to disk and flushed. Can we add an exec to "sync" for *nix environments to this command?

EDIT: Also, if it's needed, I made a copy of my world after starting up (while the server was running), so I'm guessing that level.dat would have already been overwritten. (Also, the file b/world/region/r.-1.0.mca was modified as it was read, but I would expect that since the server was running.)

Attachments

Comments 8

Intended. The /save-all command "forces the server to write all pending changes to the world to disk", according to the MC Wiki. The command is NOT used to save player data.

This site is NOT for feature requests. Please go here: http://www.reddit.com/r/MinecraftSuggestions

Ahh, so "save-all" really means "save-world". I can handle that. Thanks.

OK, I have added a suggestion to reddit. I still might suggest that "save-all" is misleading and that "save-world" may be more appropriate.

In fact save-all does also save the player data (see screenshot).
In your case the host computer didn't flush the saved data to the hard disk or the power failed just in the moment as the host was writing the player files to the disk - that file was half-written and corrupted.

Thank you for the follow-up and clarification! I have updated the wiki page (http://minecraft.gamepedia.com/Commands) to reflect this. I'll also correct my previous suggestion (that this be added) and create a new one to request /bin/sync to be run (or attempted to).

Keep in mind that /bin/sync is a *IX command and not available on Windows.

just an idea (didn't try that):

save-sync

#!/bin/bash
echo save-all > /proc/$(pidof java | grep minecraft_server.jar)/fd/0
sync
sync

Hey, that's awesome!! 🙂

As far as /bin/sync being *nix, I know. ;( I presume that Mac has a similar command since it's unix-like. I posted a suggestion here: http://www.reddit.com/r/minecraftsuggestions/comments/2ajo1m/saveall_should_attempt_to_run_binsync/ I don't remember if Runtime.exec() blocks or not, so I posted the example using a thread.

It's been so long since I've done windows programming that I don't remember the API call for this, or if there even is one.

Daniel Santos

(Unassigned)

Unconfirmed

Minecraft 1.7.9

Retrieved