The bug
When you're dead, entities which are removed server-side remain loaded client-side. This can cause severe lag when you're working with spawners.
Note: In recent versions this changed so entity creation is not processed either while dead. This results in massive lag when respawning.
How to reproduce
Set up an always active repeating command block with this command
/summon item ~ ~1 ~ {Item:{id:stone_sword,Count:1b},Age:5999,Passengers:[{id:item,Item:{id:stone_sword,Count:1b},Age:5999,Passengers:[{id:item,Item:{id:stone_sword,Count:1b},Age:5999,Passengers:[{id:item,Item:{id:stone_sword,Count:1b},Age:5999,Passengers:[{id:item,Item:{id:stone_sword,Count:1b},Age:5999,Passengers:[{id:item,Item:{id:stone_sword,Count:1b},Age:5999,Passengers:[{id:item,Item:{id:stone_sword,Count:1b},Age:5999,Passengers:[{id:item,Item:{id:stone_sword,Count:1b},Age:5999,Passengers:[{id:item,Item:{id:stone_sword,Count:1b},Age:5999,Passengers:[{id:item,Item:{id:stone_sword,Count:1b},Age:5999}]}]}]}]}]}]}]}]}]}
Set your spawnpoint next to the command block
Go stand in front of the items and kill yourself
Wait some minutes before pressing the "Respawn" button
❌ After the "Respawn" button is pressed the game lags (intensity depends on how long you waited)
Another way to reproduce (LAN world)
Start Minecraft in 2 windows with both different names (so use one in offline mode)
Start a new LAN world
Join the LAN world with the other Minecraft window
Set the difficulty to peaceful
Press
F3
and kill yourself using/kill
Now start spawning a zombie with a spawn egg with the player that is still alive
→ The zombies will disappear on the window with the player that is alive but they won't on the screen of the dead player. You can also see that value of "All" on the debug screen is different in the two windows.
Code analysis
Based on 1.12 decompiled using MCP 9.40 PRE 1
The code to send entity destroy packets to the client is in the method net.minecraft.entity.player.EntityPlayerMP.onUpdate()
which only runs if the player is alive.
20w08a Mojang name: net.minecraft.server.level.ServerPlayer.tick()
Linked issues
is duplicated by
relates to
Comments
confirmed
Is this still a concern in the current Minecraft version 14w06b / Launcher version 1.3.8 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.
nope, seems to be fixed
ok wait, it actually isn't fixed. Can someone reopen this? Here's a new way to reproduce:
-make a fast clock
(/setblock ~-1 ~ ~ redstone_block
and
/setblock ~1 ~ ~ stone
-spawn an item with age set to 5999:
/summon Item ~ ~1 ~ {Item:{Count:1,id:"diamond"},Age:5999}
-go stand in front of the item and kill yourself
-watch the entity count go up in the debug screen.
This still isn't fixed, can a mod reopen this report?

This is still a problem. Confirmed for 14w19a
Reopened.
I can see why this causes much lag, +vote

Confirmed for 14w20b

Confirmed 14w21b

Confirmed for 14w26b

Confirmed 14w31a

Confirmed 14w32a

Confirmed for 14w34b

Confirmed for 14w34d
confirmed for pre3
Still in 1.8.2-pre1
Confirmed for 1.13.1

Cannot reproduce in 20w08a using the singleplayer reproduction steps. Is someone else still able to reproduce it?
Nevermind, it appears now the client is not processing the entity creating packets either resulting in them piling up and causing massive lag when respawning.

Can confirm in 21w40a. Side note: the log also spams "Received passengers for unknown entity" for whatever reason as well.

Can confirm in 1.19.3 and 23w04a
This appears to no longer happen.
Is this still a concern in the current Minecraft version 1.7.2 / Launcher version 1.3.4 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.