mojira.dev
MC-63

Player data and region files not written/saved to disk simultaneously, causing item loss/duplication

The bug

Due to player data and region files not written to disk simultaneously, items can be duplicated quite easy under certain conditions. As of 1.16, Minecraft can be configured to run in synchronous disk i/o mode, making this issue more obvious and easier to reproduce.

How to reproduce

  1. Make sure syncChunkWrites in options.txt is set to true

  2. Create a world and fill your inventory with things

  3. Leave the world to make sure player data gets written to disk

  4. Rejoin the world

  5. Die

  6. Forcefully terminate minecraft's java process (Taskmanager, /taskkill, ...)

  7. Rejoin the world
    → ❌ Notice things you've collected now appear on the ground and in your inventory

Video demonstrating the issue (potentially outdated regarding reproduction): https://youtu.be/0RYRj5XN8vk?t=25s

Related issues

MC-16358 Item duplication bug MC-19596 duplicate bonus chest MC-24546 Dupe using a chest in Singleplayer MC-151328 Item duplication 1.14 MC-154379 1.14.2 Item Dupe. MC-156609 duplicating items death glitch MC-158297 Dupe in 1.14.4 Involving opening one world in two instances at the same time MC-158465 Inventory duplication on player death MC-163997 Losing Chestplate during Power Outage MC-173045 Duping on Servers MC-191057 DUPE bug on single player TOO OP!! MUST PACH MC-191841 Minecraft brand new dupe bug MC-192430 Return Portal did not form in the Nether. MC-199863 Duplication Glitch using Crafting Tables MC-200526 Deleted Items in hand after crash MC-201728 dupe items issue MC-202060 If you open a crafting table and put items, game craft, boom items duped MC-202117 Duplication bug MC-205022 End City 20w45a bug MC-211909 Duplication Glitch MC-215198 transported to last location after dying and found the items I had already picked up and were currently in my inventory there at the location when I spawned in. MC-229166 Duping-Bug (Items, XP) MC-229571 World Optimization is producing strange results MC-232140 Duplication glitch involving restarting device MC-234631 minecraft duplication glitch MC-238666 Duplication glitch/Cancel death on Hardcore (without a totem of undying) MC-238690 Infinate respawn glitch for hardcore minecraft MC-239150 OP Duplication Glitch MC-242889 Item duplication bug MC-258946 A bug with the possibility of a dupe, or loss of resources. MC-259031 New found Duplication Glitch 1.19,3 MC-260843 Items will dupe on Task Manager exit. MC-260928 The game doesn't autosave world data and player data at the same time MC-262457 Closing the game in an unsaved world can cause items put in a container to be duplicated and items taken out of a container to be deleted. MC-262558 Duplication bug? MC-262937 Death Dupe Glitch MC-263566 Infinite netherite MC-263647 Duplication of items after death. MC-263749 A dupe item glitch MC-265991 Items disappear if game crashes/freezes when chest/barrel is open (inventory screen and storage screen are both open) MC-273123 Ability to dupe certain items and even delete them forever MC-273643 Duplication of inventory using chests and/or barrels MC-273980 The Dark Chunk Bug MC-274838 Dupplication Glitch! Items in the chest and in the Inventroy and the same time! MC-296344 Blocks missing after computer froze MCL-16879 World saves changes but player dosen't.

Comments

Tristan Allen

Just tried this, and managed to dupe a stack of diamonds and a stack of melons.

Alexander Hammett

I just tried it:
Threw a dozen diamond blocks on the ground, pressed esc then again, then force-closed the game.
When i reopened minecraft the items on the ground were invisible, but i was still able to pick them up. Interesting :/
(Running Mas OS X Mountain Lion btw)

Nathan Workman

As this has been in the game for a while I do not believe that this should not be considered a 1.4.1Pre bug. It is more a long standing bug than a bug which was a result of switching to 1.4.1Pre.

Vit Musienko

This glitch only works in 1.2.5 release, it was fixed

Tristan Allen

I tested it in 1.4.1Pre, and it worked there. As for what Nathan W. said, It's a bug that is still there, so it should be considered an ongoing bug in this version.

theinzide

is true, I'm in 1.4.2 and it worked

Zachary Connor

While this is a bug, it's not important, because it doesn't affect gameplay, as you could just as easily put yourself in creative mode and give yourself the blocks.

Isaak Rogers

@Zachary Connor
Unless, of course cheats are off.

TnT (Trinitro Toluene)

Is this still a concern on Minecraft 1.4.4 Pre-Release? If so, please update the version affected.

Chalmes (Jon)

Can't reproduce 1.4.5pre

Callum Tennant

@Isaak Rogers No, you can open to LAN then enable cheats within that menu.

Tails

Unable to reproduce. Instead of appearing on the ground and in my inventory, items disappear from both instances, which indicates this is somewhat fixed, though atleast one instance should remain after reloading the world, but I assume this is related to MC-409. Resolving for now.

Ezekiel

I cannot reproduce this bug in 1.6.2.

bob

This bug is still in the game in a similar form. Now you cannot dupe the item by alt f4, instead you must save and quit to menu but the timing is more precise.

James (inactive)

Cannot reproduce on 15w51b.

kumasasa

Is this still an issue in the current Minecraft Snapshot 15w51b or later? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.

Mustek

Reopened from MC-95793

Commander Sealand

Unable to reproduce in 1.9.0

zajo

Confirmed in 1.9.1-pre1.

null

I can't seem to reproduce this in 16w20a. I'm on OS X, and I used Cmd-Q to close the game (instead of Alt-F4). In the log it says that it saved the worlds as well as the players when I quit the game, and the item was not on the ground when I reopened the game.

Is this a Windows-only issue?

Ezekiel

Alt+f4 and command+q are very different commands.

FaRo1

Has anyone tips to reproduce this? Do I have to press Alt+F4 right when the item appears first in the hotbar, while the little animation still runs? And at what point of the animation is the probability the highest?

marcono1234

The following is based on a decompiled version of Minecraft 1.10 using MCP 9.30.

It looks like the player data is only saved when either all chunks are saved or when the player logged out. To create this bug in singleplayer the client needs to crash and before the server can shut down because the owner left the server needs to crash as well. This is very likely impossible because shutting down the server happens directly after the player data was saved.
In multiplayer this can happen more likely, if the player leaves the server and the server crashes at some point after that before the chunks are saved, but this is the intended behaviour.

But please recheck.

marcono1234

That wasn't really a code analysis but rather an explanation why it should not happen anymore

galaxy_2alex

Seems like a reasonable explanation to me. If anyone still has this issue, please leave a comment, if there is none within a reasonable time frame, this will be marked as "Fixed".

md_5

Anyone seeing similar stuff in 1.11?

Nathan Stoltenberg

This is reproduceable on Minecraft 1.11, tested with the vanilla server jar.

https://youtu.be/RvsiKgHG1rE?t=13s

Players are able to dupe items or stacks of items by sending a disconnect packet from their client and dropping an item at the same moment. The player drops the item in their hand, and closing the connection with their client upon dropping an item. When they re-connect in, the item is in their hand and on the ground.

[03:55:09] [Server thread/INFO]: pudens29 lost connection: TranslatableComponent{key='disconnect.genericReason', args=[Internal Exception: io.netty.handler.codec.DecoderException: java.lang.IndexOutOfBoundsException: readerIndex(1) + length(1) exceeds writerIndex(1): UnpooledHeapByteBuf(ridx: 1, widx: 1, cap: 1)], siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null,insertion=null}}
FaRo1

Please use the preview function (the blue symbol out the bottom left). You just sent 130 mails through JIRA.

Nathan Stoltenberg

Apologies for the multitude of emails, wasn't considering how editing affects the email servers.
As far as this bug goes, is there any chance of getting the status changed to reopened?
In addition to simply dropping items on the ground, players are also able to drop the item into a hopper and disconnect. The hopper updates and pulls in the item, but the player's inventory is not updated and still has the item in it, duplicating the item. This works with any item, but is especially game-breaking with shulker boxes filled with items.

iFuzion77

can confirm in 1.11.2

M. C.

Confirmed for latest snapshots 17w17a and 17w17b.

James Mills

Confirmed for latest snapshot (18w15a)...

Pau Olivares

This glitch/bug is confirmed for Minecraft 1.13-pre1.

xyz

Confirmed for Minecraft 1.13-pre2.

galaxy_2alex

I am unable to reproduce with the steps given in 1.14-pre5. Can someone else?

If not, I will close this ticket after seven days.

Adrian Östergård

Is this still an issue in 1.14.4 or later?

violine1101

I'm unable to reproduce in 1.14.4. The game now seems to save the current state of the world when Alt+F4 is used. This bug might still exist if there is a way to close the game without saving.

FaRo1

Of course there is. Killing the process. Either using the task manager or by holding F3+C.

violine1101

Yes, killing the process closes the game without saving, but the inventory isn't saved either, meaning only the items laying on the ground remain. Seems like this might have been fixed indeed.

F3+C saves the game completely before causing a crash.

FaRo1

You can initiate a save by pressing Alt+F4 and then stop the process with the right timing.

violine1101

Then please provide some consistent reproduction steps for that that don't cause the world file to be corrupted.

slicedlime

New repro steps provided in MC-161408.

W_V

Cannot reproduce in 1.15.2 (this)

Conem

Could anyone who has been able to reproduce this issue in 1.15+ provide detailed repro steps, please? None of the mentioned above work in 1.16-pre2.

zajo

I just tried to replicate this in 1.16.1 using the new instructions in the bug report. Could not get it to work. I used ALT+F4 and kill process in task manager. Maybe it needs just the right timing.

wobst.michael

Use the task manager to forcefully kill the java thread. I've just noticed that ALT+F4 places a WM_CLOSE causing Minecraft to quit gracefully.
Also do it right after you have died to reduce the chance that player data gets written to disk in the meantime.

galaxy_2alex

Modified title of report to be found more easily.

Jibril Wathon

Can raproduce in 1.12.2, 1.13.1, and 1.14.4 with different method. But still cant reproduce on 1.15.2 and 1.16.1

Ceresjanin123

This happened to me by accident
Basically I died on my friends server and a few minutes later the server crashed.
When the server restarted my items were still on the ground and in my inventory

PR0CESS

Now that chunks save whenever in 1.18, its going to be harder to see this effect without a lower render distance. Just giving a heads up

pulpetti

In 22w03a.

Mask3D_WOLF

Can anyone reproduce in 1.19.2?

Antwnhs M.

Cannot reproduce this in vanilla 1.19.2

Mask3D_WOLF

Can anyone reproduce in 1.19.3?

charlie_weirdo

This happened to me in 1.19.3 when my computer froze. I got 32 free chests!

Brain81505

Can confirm in 23w03a

Brain81505

Can confirm in 23w04a

Brain81505

Can confirm in 23w06a

Brevort

This not only can duplicate items but can also destroy items. I lost a chest full of stuff because of this bug because my computer crashed

Brain81505

Can confirm in 23w18a

NguyenFranky

Can confirm in 1.20

Brain81505

Can confirm in 23w32a

Jean Dubois

Can confirm in 1.20.5

Chilenderino

Couldn't manage to confirm 24w37a

Minecraft386882

Can confirm in 1.21.4 

Minecraft386882

Affects 25w03a

Minecraft386882

Affects 25w20a

Marshall Bolwes

Mask3D_WOLF

(Unassigned)

Confirmed

Platform

Normal

Player

duplication, multiplayer, singleplayer

Minecraft 1.4.1, Snapshot 13w19a, Snapshot 13w21a, Minecraft 1.8.8, Minecraft 16w02a, ..., 1.21.1, 24w40a, 1.21.4, 25w04a, 1.21.5

Minecraft 1.4.5

Retrieved