ArchaicFix icon indicating copy to clipboard operation
ArchaicFix copied to clipboard

Consider fixing player duplication

Open DrParadox7 opened this issue 2 years ago • 1 comments

Consider fixing a glitch in multiplayer worlds where players are able to duplicate their own character by timing out.

The result is, once the player logs back in, their duplicate character will have the same inventory, at which point they can kill to dupe its contents: image

https://bugs.mojang.com/browse/MC-37586 Possibly related to: https://bugs.mojang.com/browse/MC-92476

Likely fixed by Java Edition 16w06a and eventually officially adopted in 1.9

DrParadox7 avatar Aug 05 '23 15:08 DrParadox7

Some other info

  • the ghost player appears in /list, and if the ghost and real player are online, the player will be shown twice in the multiplayer menu player list preview
  • /kick does not work at all on the ghost player
  • the ghost player will time out after some time
  • the logs don't contain anything unusual, aside from 2 join messages for the same player without a leave inbetween

From looking at the code and the info that /kick doesn't work, I suspect that the server network socket gets stuck in a broken state. Kicking players (both /kick and the "logged in from another location kick") send the Disconnect packet and then close the socket when that's done. If there is some state that the socket could be in where the disconnect packet waits in queue forever (and the connection doesn't time out for some time), the socket also won't be closed and the player won't be despawned. The kicking of the previous player on join doesn't seem to actually wait for the disconnect to succeed, so the player can finish joining even though kicking of the other instances hasn't succeeded yet. Newer versions seem to fix this by refactoring some logic so it can call the disconnect handler right after the kick is attempted, ensuring that the player is removed even if the kick disconnect packet doesn't go through (haven't looked at exactly the snapshot in question though).

leumasme avatar Sep 25 '24 16:09 leumasme