Skip to content

Ghost players in lobby servers #344

@Peacockli

Description

@Peacockli

What happened?

When a player disconnects from the server at the end of a match, just before the match transitions back to the lobby state, their client entry is not properly removed from the server's session. This causes a "ghost" player to show up in the lobby screen. When there are no real players remaining, the server will start a new match instead of remaining in a waiting state in the lobby for actual players to join. This effectively traps the server in a loop of starting empty matches.

Expected behavior

When a player disconnects from the server, regardless of the timing, their client entry should be fully and properly removed from the server's session and the lobby. If no actual players remain in the lobby, the lobby should enter and remain in a "waiting for players" state, not automatically start a new match.

Expected console output when disconnecting:

iw4x_server  | start0:^Jh^Ha^7u^Ku^Iu EXE_DISCONNECTED
iw4x_server  | Removing xuid c39ba4532f930acd (clientNum 0) from session
iw4x_server  | Removing player at slot 0 (xuid is c39ba4532f930acd) for this reason: PLATFORM_DISCONNECTED_FROM_SERVER
iw4x_server  | Voice: Unregistering slot 0 (c39ba4532f930acd) from gameSession [00000001]
iw4x_server  | We were unable to find our own clientNum in Voice_UnregisterRemotePlayer()
iw4x_server  | Clearing party member 0's party info for gameSession
iw4x_server  | Removing xuid c39ba4532f930acd from the session because nobody is registered at that slot (slot 0)
iw4x_server  | Calling XSessionLeaveRemote for slot 0 (c39ba4532f930acd) in session 'gameSession' [00000001]

Steps to reproduce the behavior

  1. Host a lobby server.
  2. Play a match to completion.
  3. As the game is ending (specifically, during the very brief interval after final scoreboard is shown but just before the game returns to the lobby state), disconnect from the game server.
  4. Observe the server console output:
    • Notice the absence of "Removing xuid..." and "Removing player at slot..." etc messages for the disconnecting player, which are present during normal disconnects.
    • The server will then proceed to shutdown the game.
    • Instead of entering a WAITING state and staying there, it will transition to WAITING and then to PREMATCH and StartMatch() for a new game, even though no actual players are connected.
    • This cycle will repeat after the new (empty) match ends.

For easier testing you can force the issue to occur without timing or waiting for end of match if u put the following in a gsc script:

player waittill( "disconnect" );
ExitLevel( false );

How often does this occur?

  • Always
  • Sometimes
  • Rarely
  • Only once

IW4x Version

IW4x MP r4987 build win-x86 Nov 23 2025

Operating System

  • Windows 10
  • Windows 11
  • Other:

CPU

No response

GPU

No response

RAM

No response

Did IW4x crash?

  • Yes
  • No

Crash address

No response

Minidump file

No response

Error message

No response

Console output or error messages

iw4x_server  | start0:^Jh^Ha^7u^Ku^Iu EXE_DISCONNECTED
iw4x_server  | Error: Unable to set last round results for client num: 1
iw4x_server  | Error: Unable to set last round results for client num: 2
iw4x_server  | Error: Unable to set last round results for client num: 3
iw4x_server  | Error: Unable to set last round results for client num: 4
iw4x_server  | Error: Unable to set last round results for client num: 5
iw4x_server  | Error: Unable to set last round results for client num: 6
iw4x_server  | Error: Unable to set last round results for client num: 7
iw4x_server  | Error: Unable to set last round results for client num: 8
iw4x_server  | Error: Unable to set last round results for client num: 9
iw4x_server  | Not performing map rotation as we are hosting a lobby server!
iw4x_server  | CL_Disconnect called for local client 0
iw4x_server  | Not setting unlocked items as new because we have not initialized itemsUnlocked. This should only happen after a map load error.
iw4x_server  | Saving lastPlayedTime of 1765495373.
iw4x_server  | Setting MP Completion to 1200 percent for controller #0.
iw4x_server  | Not uploading stats: no statWriteNeeded (cont 0)
iw4x_server  | ----- Server Shutdown -----
iw4x_server  | ==== ShutdownGame (1) ====
iw4x_server  | 1:bot1 EXE_DISCONNECTED
iw4x_server  | 2:bot2 EXE_DISCONNECTED
iw4x_server  | 3:bot3 EXE_DISCONNECTED
iw4x_server  | 4:bot4 EXE_DISCONNECTED
iw4x_server  | 5:bot5 EXE_DISCONNECTED
iw4x_server  | 6:bot6 EXE_DISCONNECTED
iw4x_server  | 7:bot7 EXE_DISCONNECTED
iw4x_server  | 8:bot8 EXE_DISCONNECTED
iw4x_server  | 9:bot9 EXE_DISCONNECTED
iw4x_server  | CL_Disconnect called for local client 0
iw4x_server  | Not uploading stats: no statWriteNeeded (cont 0)
iw4x_server  | ---------------------------
iw4x_server  | Unloaded fastfile iw4x_localized_english
iw4x_server  | Unloaded fastfile patch_mp_nuked
iw4x_server  | Unloaded fastfile iw4x_team_opforce_airborne
iw4x_server  | Unloaded fastfile iw4x_team_us_army
iw4x_server  | Unloaded fastfile mp_nuked
iw4x_server  | Unloaded fastfile mp_nuked_load
iw4x_server  | Loading fastfile ui_mp
iw4x_server  | Loading fastfile localized_ui_mp
iw4x_server  | Loading fastfile iw4x_ui_mp
iw4x_server  | Loading fastfile iw4x_localized_english
iw4x_server  | Waited 111 msec for asset 'ui_mp/menus.txt' of type 'menufile'.
iw4x_server  | Waited 6 msec for asset 'FONT_ICON_HINT_AUTO_COMPLETE' of type 'localize'.
iw4x_server  | execing default_xboxlive.cfg from disk
iw4x_server  | Gamestate changing due to a call to ResetState
iw4x_server  | Waited 7 msec for asset 'MPUI_NUKED' of type 'localize'.
iw4x_server  | Gamestate changing due to playlist entry change
iw4x_server  | execing default_xboxlive.cfg from disk
iw4x_server  | execing default_720p.cfg from fastfile
iw4x_server  | Gamestate changing due to the lobbyState gaining the WAITING flag
iw4x_server  | Gamestate changing due to gameStartTime being set in PREMATCH state
iw4x_server  | Sending 'go' command to clientNum 0 in StartMatch()
iw4x_server  | Telling ^Jh^Ha^7u^Ku^Iu~ to launch into the game at time 139262

Mods or custom content

No response

Screenshots/Videos

No response

Additional information

No response

Checklist

  • I have searched existing issues to ensure this is not a duplicate
  • I am using the latest version of IW4x from the develop branch
  • I have read the documentation and troubleshooting guides
  • I have provided all the requested information above

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions