Ghost users remain in user list for days — can't disconnect or monitor

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

Post Reply
ciaoamigos
Posts: 70
Joined: 05 Sep 2021, 16:57

Ghost users remain in user list for days — can't disconnect or monitor

Post by ciaoamigos »

I'm experiencing a strange issue with my SmartFoxServer (using a custom extension). Occasionally, some nicknames remain visible in the user list for days — as if they're still connected. However, when I try to monitor or disconnect them from the AdminZone, I get this message:

"The User being monitored is no more available on the server, please select another one."

This seems contradictory — if the user is no longer on the server, then why is their nickname still visible in the user list? I can’t monitor them, can’t disconnect them, and yet they’re stuck in the interface.

Unfortunately, I can't afford to restart the server every time this happens, so I’m looking for some guidance:

What could be causing this? Could it be an improperly closed session?
Is there a way to clean up these “ghost” users programmatically, without restarting the server?
Can I verify or remove invalid sessions through my extension?
I'm already using UserDisconnectHandler to manage disconnections and update the database properly. The user session stores fields like login_timestamp, user_id, and others at login.

Any insights or similar experiences would be greatly appreciated.

Thanks a lot!
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Ghost users remain in user list for days — can't disconnect or monitor

Post by Lapo »

Hi,
what version of SmartFoxServer are you running?
In SFS2X there's already a mechanism for dealing with "ghosts", which are usually caused by half-disconnections. In simple terms a half-disconnection is one that is only acknowledged by one side of the communication, in this case it's usually the client.

This means that the server did not receive the disconnection sequence (at TCP level) and therefore the OS still thinks the connection is active. This situation is typically solved by the OS itself via a timeout mechanism which eventually triggers the disconnection. This in turn triggers SFS2X to remove the User.

Via the AdminTool > Server Settings make sure that "Enable Ghost Hunter " is turned on.

Finally check your log files and see if you have any recurring exceptions, especially if the occur when a disconnection is logged (before or after).

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
ciaoamigos
Posts: 70
Joined: 05 Sep 2021, 16:57

Re: Ghost users remain in user list for days — can't disconnect or monitor

Post by ciaoamigos »

Hi,
yes, I'm aware of the ghost handling mechanism in SFS2X and I do have Ghost Hunter enabled.

Checking the logs is quite complex in our scenario due to the high volume of user logins and logouts, which makes it difficult to pinpoint specific issues. However, I haven’t noticed any recurring exceptions being thrown around the time of disconnections.

Let me know if there's any way to improve detection or cleanup in high-traffic situations!
Post Reply