Ghost users - Bad disconnections

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

dvine
Posts: 47
Joined: 21 Sep 2006, 10:08
Location: Köln, Germany
Contact:

Ghost users - Bad disconnections

Postby dvine » 21 Apr 2008, 08:19

Hey there,
let me explain my problem:

I have some users in my room, then one of them loses his internet connection and thus is not properly disconnected from smartfox. He is still visible in the admin tool and cannot connect again.

To work around this problem i have a very short MaxUserIdleTime of 120. To keep users from getting disconnected i have a client-interval that calls a dummy extension every 60 seconds to keep the user from being disconnected.

This all worked fine until i switched my main room into a "limbo room" - now the user gets disconnected after 120 secs, although he does still call the extension... What should i do?

Sincerely
Daniel Weingarten
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 21 Apr 2008, 16:34

There's probably something else going on... when a user calls an extension its internal timer is updated and this is not related with the type of room where the user is in.

In other words, the type of room won't affect the requests to the server side extension (and the timeout mechanism).

Are you sure that this behavior is consistent? (regular room = works, limbo room = doesn't work)
Lapo
--
gotoAndPlay()
...addicted to flash games
dvine
Posts: 47
Joined: 21 Sep 2006, 10:08
Location: Köln, Germany
Contact:

Postby dvine » 24 Apr 2008, 10:44

How do i see why the client got disconnected?
So that i can test what the cause might be... I tested a lot but am without a clue at the moment...
The client always gets disconnected after 4 Minutes... Cant be because of idle time, since that is 2 minutes... hmm
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 28 Apr 2008, 06:34

There's no way to determine a client disconnection. Technically speaking there is no difference when a browser crashes or when it is closed or if the client computer is shut down etc...
The server simply acknowledges a disconnection and fires an event.

The client always gets disconnected after 4 Minutes... Cant be because of idle time, since that is 2 minutes... hmm

You say the "client"... is this happening to a client only?
Lapo

--

gotoAndPlay()

...addicted to flash games
mixart
Posts: 95
Joined: 08 Aug 2007, 20:32

Postby mixart » 30 Apr 2008, 06:06

I've had this problems for months. My users have learned to deal with it.

When users lose their internet connection they are disconnected and they cannot re-connect because they get a "username already taken" and have to wait until my server idle time timesout which I have set quite high due to the nature of my application (many people sit back and watch without interacting).

I know this isn't a one off issue because I've probably had 50 people report the issue on different occasions over the past months.

I haven't implemented an auto ping to keep people connected because people would stay logged into my application and go eat dinners, etc. using up connections.

I never have found a solution.
dvine
Posts: 47
Joined: 21 Sep 2006, 10:08
Location: Köln, Germany
Contact:

Postby dvine » 02 May 2008, 08:33

its happening to every player that is not in a game room at that time...
very strange... let me look into this... will keep ya posted...
soupman
Posts: 10
Joined: 10 Apr 2008, 20:08
Location: Tampa, FLorida
Contact:

The ghost connection lives on

Postby soupman » 12 May 2008, 14:04

I have the same problem except I have kids who can't wait for the server to time out.

The odd thing is that it ONLY happens on a remote connection (not on the local LAN). A connection made within our office NEVER gets dropped. I have had 10 users logged in with different ids on one (1) computer and running a simulation -they were all moving, chat, emoticon usage and switching room to room NO connections lost.
Users who log in outside of the LAN can be dropped for no reason and without a time limit. SFS shows them as still being logged in but in fact there session has terminated. The only way back in is to let the server disconnect them after the set time has expired.

Here is the log file showing the point of a lost user, which shows a dynamically created room, the user joins the room and exits the the room he or she came from. The user was playing the game for about 1 minute and them was dropped. They could not log back in until 10:34 when the server disconnected them for idle time.

2008/05/10 10:23:41 | [dbExtension.as]: Event received: newRoom
2008/05/10 10:23:41 | [simpleExt.as]: Event received: newRoom
2008/05/10 10:23:41 | 09:23:41.972 - [ INFO ] > Room [ 4square2 ] created!
2008/05/10 10:23:41 | [dbExtension.as]: Event received: userJoin
2008/05/10 10:23:41 | [simpleExt.as]: Event received: userJoin
2008/05/10 10:23:41 | [dbExtension.as]: Event received: userExit
2008/05/10 10:23:41 | [simpleExt.as]: Event received: userExit
2008/05/10 10:34:16 | 09:34:16.315 - [ INFO ] > Disconneting idle user: christian
2008/05/10 10:34:16 | [dbExtension.as]: Event received: userLost
2008/05/10 10:34:16 | [simpleExt.as]: Event received: userLost
2008/05/10 10:34:16 | [dbExtension.as]: Event received: roomLost
2008/05/10 10:34:16 | [simpleExt.as]: Event received: roomLost
2008/05/10 10:34:16 | 09:34:16.319 - [ INFO ] > Game Room Deleted: 4square2

Let me better define a dropped connection - The user (client) gets booted back to the login screen of the flash application that is currently running for no apparent reason. According to SFS admin panel they are still there and everything is fine.

SFS 1.5
AS 2.0

We need help on this, Anyone Please

EDITED POST --------

After testing today, it appears the problem is NOT directly with SFS but in Flash/SFS combination. The reason I believe this is true is because of the following;
If the clients internet connection between the client and server is interrupted on the client side the client gets booted to the Flash application login in screen. SFS does not know that this has happened therefore it holds the connection open and live. The blip in internet connection is only a few milliseconds but enough for Flash to think it has lost connection but not enough for SFS to see this.
If we intentionally cause this blip in our office, we can repeat what the client experiences on their side.
The application:
Our application loads a main interface screen (container), which contains all of the controls. As we move from room to room we load a corresponding SWF to match the room the user has selected but we always maintain the user interface (container) in which everything is loaded into - hence when a blip in connection occurs Flash maintains the user interface and takes the user to the login screen but cannot remember what swf was loaded.

Now the big question - IF we are correct in our assumptions of what is occurring, how do we handle these blips in internet connection and maintain the client experience? Did we code this incorrectly to load rooms into a container? Should it be handled differently?

Any help here would be greatly appreciated!
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 13 May 2008, 14:32

If the clients internet connection between the client and server is interrupted on the client side the client gets booted to the Flash application login in screen. SFS does not know that this has happened therefore it holds the connection open and live. The blip in internet connection is only a few milliseconds but enough for Flash to think it has lost connection but not enough for SFS to see this.


If you interrupt the connection the socket is closed and it's not usable anymore. The client API will then simply fire an onDisconnection event.
What happens from that moment simply depends on your code.

We call these "sloppy disconnections" or "ghost connections" and they are quite popular with Flash :(
Unfortunately there's not much we can do on the server side as the JVM doesn't acknowledge the disconnection for a while (this in turn depends on the underlying tcp stack)

The only system to clean these pending sockets is to check them for activity from time to time and finally force the disconnection from server-side (that's what maxIdleUserTime param is for)

I see you use SFS 1.5, we have improved the handling of these ghost connections since version 1.5.9. I'd recommend to at least update to that patch. Version 1.6 added further optimizations and we plan to add a few more soon.
Lapo

--

gotoAndPlay()

...addicted to flash games
soupman
Posts: 10
Joined: 10 Apr 2008, 20:08
Location: Tampa, FLorida
Contact:

Lost Client

Postby soupman » 13 May 2008, 18:07

Lapo,

We now better understand the issue with Flash but we cannot understand why the client (user) consistently gets dumped off the system. It cannot be a bad internet connection all the time as we have 3 different network providers on our end and clients from all over the country using different providers. This gives us a good indication that the problem is not a local connection problem.

Users loose connection from 8-14 minutes into the game. When they time out and come back in it appears that it happens again in 4-6 minutes although not consistent.
It does not matter what room they are in or how many they have requested. Additionally there are only one or two users on the system testing this when it occurs. We have used IE and Firefox both react the same way – completely closing both and restarting them did not fix the problem either.

We cannot open this up to the public until this is solved and are at a loss right now. You may try it for yourself at wetsoup.com if you need a user and pass PM me.

Yes we have installed 1.6.2 and it is running - no change in status :?
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 14 May 2008, 12:54

Yes, I will certainly test. If you could provide a login that would help. Just send me a PM.

Also I'd like you to test another simple thing. Try connecting as admin using the AdminTool and just leave it there connected.
Unless you have automatic standby in your power-saving settings you should never get disconnected. (except for bad network hiccups)

Let me know what it does.
Lapo

--

gotoAndPlay()

...addicted to flash games
Rutter
Posts: 99
Joined: 12 Dec 2007, 16:21
Location: Canada
Contact:

Postby Rutter » 18 May 2008, 16:06

Hi all,
I just wanted to add my voice to this as well. I had opened up a thread called random disconnects back a while. This situation has never gone away and is similar to your issues discussed here. Lapo originally said he thought it was the hosting provider that had a network issue but I have tried 3 other providers from different parts of North America since and it still continues to be a problem.
The disconnects are random, the admin panel shows the clients as connected and the client flash app will not transmit anymore data over the network.
The clients are never disconnected until I disconnect them in the admin panel and we keep the admin panel on at all times. They do not time out naturally. We had also incorporated a ping every 30 seconds at one time and this too did not solve the problem so we removed it. We have never been able to figure out the cause of these disconnects.
We are still in development and testing but this remains a worry that we wont be able to overcome this issue.
soupman
Posts: 10
Joined: 10 Apr 2008, 20:08
Location: Tampa, FLorida
Contact:

Ping fails

Postby soupman » 19 May 2008, 01:52

Rutter -
In regard to your problem we did the same thing- ping/extension calls you name it. The only way to keep the server and client connected is to send a chat string. We send a character and suppress it to the other users. We have maintained connections for days not minutes.
I don't believe this is the best solution but it is the only one we have found to work consistently.

jk
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 19 May 2008, 05:33

Rutter: of the most simple ways for restricting the possible causes for this issue is to create a very simple application and test it live.
You could just take the "Simple Chat" or "Advanced Chat" examples that we provide out of the box and check it live on your server.
See how it behaves and also please provide us with a link so that we can check it as well.

It would also help to understand how many users are having this problem. It is highly likely that the problem is on the client side (unless you tell me that this happens consistently to every user)
If so, maybe certain users behind the same ISP might have problems due to specific problems with that ISP.

For example the problem reported by soupman was not reproducible on our side. We connected and used the application for almost 30 minutes without any disconnections at all.

soupman
We didn't find any problem. Are you saying that this is happening every time? We checked more than once and the client never got disconnected.

All I can suggest is what I said earlier. Setup a "hidden" zone for the "Simple Chat" and test it. And if you have problems send us the link and we'll check.
Lapo

--

gotoAndPlay()

...addicted to flash games
soupman
Posts: 10
Joined: 10 Apr 2008, 20:08
Location: Tampa, FLorida
Contact:

disconnect

Postby soupman » 19 May 2008, 12:02

Lapo,

Yes we still have the problem.
The reason you did not disconnect is because we are sending a 1 character string. I will set up another zone using the simple chat example without this string.
The admin panel does not stay connected. It looks like it is connected but when you hit refresh after a few minutes it will tell you it has lost connection.

I will PM the link
jk
Rutter
Posts: 99
Joined: 12 Dec 2007, 16:21
Location: Canada
Contact:

Postby Rutter » 19 May 2008, 14:12

Soupmans last comment reminded me that our admin panel also looked like it was connected until you try to refresh and then it would tell you it has lost the connection.

Lapo, yes we used the simple chat example and our own client to test, the results were the same. We had disconnects with as little as 2 clients connected. It's very odd since most developers have no issues at all with disconnects and yet we were consistent right out of the box with disconnect issues. We tried clients connected to different isp providers, then we changed hosting companys. The problem got worse. Because of this I still wonder if there is something with network issues that is causing this but we can't find the answer. The original hosting provider spent a lot of time trying to track down issues on their end but could find no anomalys at the times that we reported disconnects. Thats when we tried changing hosting companies from Seattle to Georgia and it got worse.

Currently we are just running a development cpu that has the server running. Last week a friend tried to chat with me. He disconnected 3 times in under 4 minutes and we gave up. Haven't tried since. I may try soupmans solution and see if that works.

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 78 guests