[SPIGOT-2622] Server shutdown only disconnects half players cleanly Created: 22/Aug/16  Updated: 23/Aug/16  Resolved: 23/Aug/16

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Andi Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None

Attachments: PNG File Bildschirmfoto vom 2016-08-22 14-44-01.png     PNG File Bildschirmfoto vom 2016-08-22 14-44-13.png     PNG File Bildschirmfoto vom 2016-08-22 14-44-46.png    

 Description   

This is probably the real issue for SPIGOT-625

As you can see on the screenshots, the stop method in MinecraftServer executes the u() metho in the PlayerList. This methods iterates over all players and executes the disconnect method in PlayerConnection. This method goes over to the disconnect(EntityPlayer entityplayer) in PlayerList where the player gets removed from the "players" list WHILE iterating.
Because every disconnect player gets removed from the "players" list while iterating, only the first half of online players get disconnected cleanly.

A simple solution would be to iterate over a copy of the "players" list on the shutdown method "u"



 Comments   
Comment by Andi [ 22/Aug/16 ]

Since the "players" list is a CopyOnWriteArrayList you could also iterate via for loop
for (EntityPlayer player: players)

Generated at Thu Mar 27 17:02:34 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.