mojira.dev
MC-254036

Entity data sometimes doesn't get properly updated in multiplayer

Entity metadata doesn't get properly updated for clients in a multiplayer game in some circumstances due to a networking race condition.

Steps to reproduce

  • Start two instances of the game (make sure to use two different usernames, say host and guest)

  • Open a LAN server (creative, allow cheats) on a fresh void superflat world

  • Place two command block minecarts on connected activator rails (so they activate together)

  • Command in one minecart: /tp @p[name=host] ~ ~1 ~

  • Command in second minecart: /data modify entity @e[type=pig,limit=1] HasVisualFire set value true

  • Spawn a pig near the minecarts: /summon pig ~ ~ ~ {NoAI:1}

  • Join the server with the second player (guest)

  • Teleport the host far away (200 blocks)

  • Activate the minecarts using the guest player

  • The pig should appear to be on fire for the host but not the guest

(The order of events is important. To be more precise: the pig needs to be spawned after the minecarts)

Code analysis

The ClientboundSetEntityDataPacket constructor called when an entity comes into a player's view calls clearDirty on the entity's data preventing synchronization with other players.

Comments 1

Can confirm this is still an issue in 1.19.2. The provided reproduction steps are very situational but this bug seems to cause various other issues and be reproducable in other ways.

Specifically, I ran into this while trying to debug an issue where the second skin layer isn't shown when many players join a server at the same time. It runs into the same race condition which prevents the skin settings from being synced with some other clients. It's hard to reproduce but happens quite commonly with large amounts of players.

Zonteek

(Unassigned)

Community Consensus

Normal

Networking

1.19, 1.19.1 Pre-release 4, 1.19.2

1.19.3 Pre-release 3

Retrieved