mojira.dev
MC-29375

Entities are not removed client-side when you are dead

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

  1. 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}]}]}]}]}]}]}]}]}]}
  2. Set your spawnpoint next to the command block

  3. Go stand in front of the items and kill yourself

  4. 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)

  1. Start Minecraft in 2 windows with both different names (so use one in offline mode)

  2. Start a new LAN world

  3. Join the LAN world with the other Minecraft window

  4. Set the difficulty to peaceful

  5. Press F3 and kill yourself using /kill

  6. 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

Comments

Talven81

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.

Jesper the End

confirmed

Deleted account

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.

Jesper the End

nope, seems to be fixed

Jesper the End

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.

Jesper the End

This still isn't fixed, can a mod reopen this report?

qmagnet

This is still a problem. Confirmed for 14w19a

Deleted account

Reopened.

destruc7i0n

I can see why this causes much lag, +vote

qmagnet

Confirmed for 14w20b

qmagnet

Confirmed 14w21b

qmagnet

Confirmed for 14w26b

qmagnet

Confirmed 14w31a

qmagnet

Confirmed 14w32a

qmagnet

Confirmed for 14w34b

qmagnet

Confirmed for 14w34d

Jesper the End

confirmed for pre3

Vladislav

Still in 1.8.2-pre1

Oval

Confirmed for 1.13.1

marcono1234

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.

ampolive

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

Brain81505

Can confirm in 1.19.3 and 23w04a

Panda4994

This appears to no longer happen.

Jesper the End

(Unassigned)

Confirmed

Platform

Important

Entities, Networking, Performance

client-side, death, death-screen, despawn, entity

Minecraft 1.6.2, Minecraft 1.6.4, Minecraft 13w37a, Minecraft 1.7.1, Minecraft 1.7.2, ..., 20w49a, 21w40a, 1.19.3, 23w04a, 1.19.4

Minecraft 14w06b

Retrieved