mojira.dev
MC-25488

Items can be deleted/duplicated on a server crash

The server doesn't sync transactions between players and chests. This way it is possible that items can get deleted or even duplicated. Steps to reproduce:

1. Start a default server.
2. Join with the client and get some wood to create a working bench/chest.
3. Place the chest somewhere and get some material (for example your remaining wood (if any) or dirt) and put it in the chest.
4. If there are now the items in the chest and your inventory is empty leave the server and then shutdown it to go sure all changes are successfully saved.
5. Restart the server and join with the client.
6. Put all items from the chest into your inventory.
7. Leave the server.
8. Immediately crash the server (for example with sending a SIGKILL signal on Linux or whatever your operating system provides).
9. Restart the server and join with the client.
10. On checking the chest and your inventory you will notice that the items got duplicated.

Additional information: This is a simple transaction-unsafe problem. Ideally it must be ensured that every change on a storage (inventory, chest, world, etc.) which also changes another storage is saved in a transaction-safe way (committing).

Linked issues

Comments 5

If you crash a server, weird things are going to happen.

Normally crashes are appearing unexpected so every running server could be affected at a time.

True. If the server crashes, it isn't hanging around to sort out inventories. It is just immediately stopped.

Correct, the information isn't written to the disk because the process logically can't do this anymore. But my startpost already includes a potential solution for this.

After making a look it seems that my volunteer theory is correct. Anyway - this problem is still a valid issue. Just think of a power loss of a server. The most hoster doesn't have control over such unexpected crashes and it will simply bork the player status of a world. Also fixing this shouldn't be really difficult.

user-ed7ab

(Unassigned)

Unconfirmed

Minecraft 1.6.2

Retrieved