ImediaseeUvaultCDNInfluxis
FlashComGuru
 
 

  Active Topics    Memberlist    Search    Help
  Register  Login
General Flashcom / Flash Media Server
 Flashcomguru Forums | General Flashcom / Flash Media Server
Subject Topic: Detecting ungraceful disconnects? Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
turbotime
Flashcom Newbie
Flashcom Newbie


Joined: 25 October 2006
Posts: 16
Posted: 20 June 2007 at 18:20 | IP Logged Quote turbotime

If im connected to fms and pull my LAN cable out of the computer, FMS still shows me as connected. Is there a way to detect this other than a heartbeat type check to all clients?

I have a heartbeat (setInterval) running that accounts for this but it seems like there should be some inherent FMS API that handles this....
Back to Top View turbotime's Profile Search for other posts by turbotime
 
jbourne
Flashcom Middleweight
Flashcom Middleweight


Joined: 03 March 2006
Posts: 81
Posted: 20 June 2007 at 18:46 | IP Logged Quote jbourne

I wish a solution for this existed. Our FMS dies every once in a while, and the only way to discover it is through a bunch of ghost connections (audio no longer plays, and all that happens is there's connects and disconnects without any activity). I've no idea how to watch for that, but I really wish I could. As it stands, I just cron a server restart nightly at 4am, but there's got to be a better solution :P
Back to Top View jbourne's Profile Search for other posts by jbourne
 
turbotime
Flashcom Newbie
Flashcom Newbie


Joined: 25 October 2006
Posts: 16
Posted: 20 June 2007 at 18:54 | IP Logged Quote turbotime

yeah the way i do the less than graceful disconnects is like this:

setInterval call all clients "verifyConnected" when thecall is made i start a timer waiting for the reply also using a setInterval. When the reply is recieved the timerInterval gets reset, if the timerInterval reaches 5seconds, it can be assumed the client is no longer connected.

It works, and it works pretty well, but the issue is it doesnt account for network latency or general flash player latency. For instance if im running the debug player and have alot of trace on a frame the timerInterval will get to 2-3seconds before the response it sent back to the server, sometimes it will take even longer (>5s) and invalidly disconnect me. I could increase it to 10sec but that isnt a very good solution either !



Edited by turbotime on 20 June 2007 at 18:54
Back to Top View turbotime's Profile Search for other posts by turbotime
 
jaycharles
Moderator
Moderator


Joined: 18 February 2004
Posts: 507
Posted: 20 June 2007 at 22:30 | IP Logged Quote jaycharles

I like to take a similar approach, but rather than call/response, I just have the client call a server side function that updates a timestamp variable in the client object (with no result object defined, and no reponse from the server side method).

Then, every X seconds, I run a server side function that loops through the client objects, and compares the client timestamp to the current timestamp. IF the client's timestamp is too old, I fire the onDisconnect for that client.

Hackish, ugly, and not at all the way I'd like it to be, but it works reliably.
Back to Top View jaycharles's Profile Search for other posts by jaycharles Visit jaycharles's Homepage
 
turbotime
Flashcom Newbie
Flashcom Newbie


Joined: 25 October 2006
Posts: 16
Posted: 22 June 2007 at 01:57 | IP Logged Quote turbotime

jaycharles,

thanks for the tip i actually switched my code to your model cause it seems more reliable when you think about it :)

I am in talks with adobe about fixing this bug- apparently fms will disconnect ghost connections on an interval, from my testing that interval is about 5min which is atrocious and the interval is NOT configurable [confirmed via adobe].

Whats worse is if you preform a client.ping() on a disconnected client it returns TRUE which is very confusing.

Hopefully my pestering adobe will get them to release a fix for this fairly serious issue, right now im talking directly with FMS engineers regarding this matter

Edited by turbotime on 22 June 2007 at 01:58
Back to Top View turbotime's Profile Search for other posts by turbotime
 
Ultimate
Moderator
Moderator
Avatar
Super Flashcommer

Joined: 05 January 2004
Location: Canada
Posts: 1130
Posted: 22 June 2007 at 04:05 | IP Logged Quote Ultimate

You're in talks with Adobe on fixing this? Wow.. I want your contact. I don't think there is a person on the FMS team that doesn't know about this bug and has know about it for years. Everybody pestered them and then gave up because there was really no response.

The main problem is that it's not so much a bug but a problem of the network. So, it's kinda hard to track down for them I think.

Hopefully they'll figure out something for v3, whenever it comes out.

__________________
Blog: http://www.sti-media.com
Community Site: http://www.FMSGuru.com
Game: Checkers
Back to Top View Ultimate's Profile Search for other posts by Ultimate Visit Ultimate's Homepage
 
jaycharles
Moderator
Moderator


Joined: 18 February 2004
Posts: 507
Posted: 22 June 2007 at 04:40 | IP Logged Quote jaycharles

Incidentally, I found that running garbage collection often gets rid of a lot of lost client objects.

I'm working on a project where we're using FME, and it takes FOREVER for FMS to realize FME is disconnected (not too sure why that is). The thing that sucks is, if FME drops the connection and FMS doesn't respond to it, when FME reconnects it can't publish to the same stream name.

I've had to resort to running GC once a second to get rid of the connections... but it seems to work. Whenever FME chokes (and it does that a lot), the client object is gone on the next GC.

Edited by jaycharles on 22 June 2007 at 04:43
Back to Top View jaycharles's Profile Search for other posts by jaycharles Visit jaycharles's Homepage
 
solisarg
Flashcom Middleweight
Flashcom Middleweight
Avatar

Joined: 30 October 2006
Location: Spain
Posts: 56
Posted: 22 June 2007 at 14:41 | IP Logged Quote solisarg

Interesting ... how do you run garbage collection explicitely?

Jorge

__________________
http://www.flash-db.com
Back to Top View solisarg's Profile Search for other posts by solisarg Visit solisarg's Homepage
 
jaycharles
Moderator
Moderator


Joined: 18 February 2004
Posts: 507
Posted: 22 June 2007 at 18:18 | IP Logged Quote jaycharles

solisarg wrote:
Interesting ... how do you run garbage collection explicitely?

Jorge


application.gc();
Back to Top View jaycharles's Profile Search for other posts by jaycharles Visit jaycharles's Homepage
 
jbourne
Flashcom Middleweight
Flashcom Middleweight


Joined: 03 March 2006
Posts: 81
Posted: 22 June 2007 at 19:28 | IP Logged Quote jbourne

On the server side's main.asc or during the client app execution in the .fla code?
Back to Top View jbourne's Profile Search for other posts by jbourne
 
turbotime
Flashcom Newbie
Flashcom Newbie


Joined: 25 October 2006
Posts: 16
Posted: 24 June 2007 at 18:24 | IP Logged Quote turbotime

probably just garbage collects in a setInterval right?

Just finished my sample client/server app that shows the client.ping() returning improper results, well see if it incites some change :crosses fingers: ill be sending it to adobe first thing tomorrow :)
Back to Top View turbotime's Profile Search for other posts by turbotime
 
turbotime
Flashcom Newbie
Flashcom Newbie


Joined: 25 October 2006
Posts: 16
Posted: 26 June 2007 at 16:04 | IP Logged Quote turbotime

ok well ive sent the app to all the right people now im just waiting to see what adobe thinks of the issue... for all of those interested here is a link to the app/client so you can see how client.ping() fails to return the proper results if you disconnect the LAN cable from one of the connected clients, check it out:

pingTest Application

Edited by turbotime on 26 June 2007 at 16:05
Back to Top View turbotime's Profile Search for other posts by turbotime
 
flashjockey
Flashcom Badass
Flashcom Badass
Avatar

Joined: 23 January 2004
Location: United States
Posts: 455
Posted: 26 June 2007 at 18:52 | IP Logged Quote flashjockey

This problem should be resolved in the next release of FMS.


__________________
Brad Outlaw
Flash Media+ Team
Adobe Systems Inc.

Disclaimer:
My posts are my own and do not necessarily reflect the views, opinions,
strategies or advice of Adobe Systems or its affiliates.
Back to Top View flashjockey's Profile Search for other posts by flashjockey
 
turbotime
Flashcom Newbie
Flashcom Newbie


Joined: 25 October 2006
Posts: 16
Posted: 26 June 2007 at 19:46 | IP Logged Quote turbotime

Back to Top View turbotime's Profile Search for other posts by turbotime
 
stoem
Big Kahuna
Big Kahuna
Avatar
stoem == Stefan

Joined: 05 January 2004
Location: United Kingdom
Posts: 1079
Posted: 18 May 2009 at 10:30 | IP Logged Quote stoem

Hi Brad,
what's the latest on this? Have any improvements been made in recent releases?

Cheers

Stefan





__________________
Flashcomguru.com
Back to Top View stoem's Profile Search for other posts by stoem Visit stoem's Homepage
 
flashjockey
Flashcom Badass
Flashcom Badass
Avatar

Joined: 23 January 2004
Location: United States
Posts: 455
Posted: 18 May 2009 at 21:57 | IP Logged Quote flashjockey

It goes without saying that many developers want that instant gratification when a user truly disconnects. However, there are several factors that play into the equation... some of those are within FMS's control, some out of FMS's control. I'll try and break it up into various options and layers.

At a very low level, FMS is bound by the network layer of the OS it's running on. Some OS's are better about gc'ing disconnected connections than others. There's also the hard disconnect that has to be factored in here (i.e. when someone yanks the network cable). The server, by proxy of the OS layer, still recognizes the connection. There's timeouts involved, etc.... Even in the Flash Player, you'll notice that it takes several seconds from the time a network is severed until you get the NetConnection.Connect.Closed event.

By default, FMS runs garbage collection on the application resources every 1 minutes. This is already set to the minimum value (in Vhost.xml). This process will clean up anything marked for GC within the app. There's also a "gc" method on the "application" class that you can call from within your application.

At a more granular level, there's the Auto Close Idle Clients feature which will automatically disconnect idle connections. Off the top of my head, I don't recall what the minimum values are for this are. In short, it runs a process every XX seconds, to disconnect clients who have been idle for YY seconds. This should work for many scenarios but isn't practical for others (such as browser not releasing an instance of FP that regularly interacts with FMS).

If you want to get even more granular, you can implement timers that regularly check timestamp differentials or ping the clients. For example: the client application regularly calls a server-side method, which in turn writes a timestamp associated with the client obj. The server app runs a process on interval that diffs the timestamps of the clients with current time. Any clients older than x seconds gets force disconnected. There's also the method of looping through the clients array, calling ping on the client object, and then running the application.gc when that's done. I can't attest to how well this works in larger scaled applications. I've found, at times, the scripting engine can be fussy with aggressive loops.

The use cases vary from app to app. In some of my own apps where I enforce unique user names, I find that simply performing a lookup and pinging the client, if exists, is sufficient.

Even with a hybrid of the afore mentioned options; at the end of the day, obtaining the holy grail of disconnects still relies on factors outside of FMS's control (@see paragraph 2).

__________________
Brad Outlaw
Flash Media+ Team
Adobe Systems Inc.

Disclaimer:
My posts are my own and do not necessarily reflect the views, opinions,
strategies or advice of Adobe Systems or its affiliates.
Back to Top View flashjockey's Profile Search for other posts by flashjockey
 

Page of 2 Next >>
  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum

Powered by Web Wiz Forums version 7.6
Copyright ©2001-2003 Web Wiz Guide


   all contents © Flashcomguru.com - Flash® is a trademark of Adobe® 1995-2007