id summary reporter owner description type status priority milestone component resolution keywords cc phab_field 3386 [PATCH] Lobby - freeze and duplicate users when returning from a match elexis JoshuaJB "{{{ #!html

Bug Symptoms

}}} '''(1)''' 0 A.D. '''freezes for a couple of seconds''' when returning to the lobby after playing a long game. '''(2)''' The '''playerlist''' sometimes contains '''online users twice''' and sometimes '''offline users once''' (while it should only display online users and no dupes). {{{ #!html

Why the bug occurs

}}} '''(1) Accumulation of thousands of presence updates''' The `XmppClient` caches all presence updates in its `m_GuiMessageQueue` variable. Usually the lobby code fetches all updates `onTick`, clearing that array frequently. But while playing a game, the lobby JS code is inactive. Therefore `m_GuiMessageQueue` accumulates over the course of a game, resulting in the application of thousands of those updates when returning to the lobby. Thus causing the freeze mentioned in '''(1)'''. '''(2) Applying those updates to a different playerlist''' The second symptom is caused by the accumulation of these updates and applying them ''after'' fetching a clean playerlist. The presence updates in `m_GuiMessageQueue` are only valid for the playerlist of the time when they were generated. But since we replace the playerlist with the most current one when returning from the lobby, these updates don't apply anymore! This for example hits all these cases: {{{ if (nickIndex == -1) // Left, but not present (TODO: warn about this?) if (nickIndex == -1) // Changed nick, but not present (shouldn't ever happen) if (nickIndex == -1) // Changed presence, but not online (shouldn't ever happen) }}} ----- This is essentially the bug discovered in #3171 (ticket description and comments 1 to 9). All the patches there attempt to fix this problem by clearing the messages. But the patches after version 2 didn't correctly handle the `g_joined` bug described in #3287 and fixed in r16961." defect closed Must Have Alpha 19 Multiplayer lobby fixed patch josh