Supporting

If you like MediaPortal please support it by making a small donation:

         Donate to MediaPortal!

Login Form



Awards

opcz_testsieger





Home arrow Blogs arrow Heartbeats - a way for TVserver to keep track of live and dead clients .
Heartbeats - a way for TVserver to keep track of live and dead clients .
Written by gibman, on 25-09-2007

Recently we have implemented heartbeat handshake/communication between the tvplugin and the TV server.

 

The purpose of this new feature is to avoid having locked tuner cards due to clients crashing. Before this feature, the server had no idea that the client was suddenly gone. The Tvserver was happily timeshifting away as if the client was still alive. This would effectively lead into a tuner-lock.

Now imagine this. If the wife now decies to tune into a channel on that locked tuner card on another multiseat client, then she would get the "no cards available" error.

A workaround to free up the timeshifting was to simply restart the tvservice, this would ofcourse kick off dead and inactive clients.

There could be many reasons as to why a client could become dead.

One of the more obvious ones could be a simple crash of mediaportal.

Now that heartbeat is fully implemented, this is no more (hopefully).

 

The client transmits a heartbeat each 5 sec. no matter what context TV is in.

The server allows for a 30sec timeout period before deciding to kick the client.

A seperate thread on the server runs through list of active users, checking if heartbeats have arrived or not.

If no heartbeat has ever been registered on a specific user, then the server is ignoring this particular user - giving it full imunity.

So VLC clients that doesn't send heartbeats and similar are not kicked ever.

The same goes for the scheduler, epg users etc. They are more "fake" service oriented users used in the tv service. 

 

All is logged to the servers tv.log 

And in the client's mediaportal.log (debug logging enabled)

So if any issues arise, those logs should tell the tale of what has happened. 

 

A note to the devs when debugging tvplugin;

If you find yourself being kicked when debugging tvplugin, this could be that your are simply standing in a breakpoint, thus preventing the client from emitting heartbeats in time. 

A temp. solution is to disable heartbeat on the client (in tvhome.sendheart()). this would give you immunity.

 

/Gibman 

 


Users' Comments (3) RSS feed comment
Posted by Gixxer, on 26-09-2007, , Registered
1. ...
this is a very good idea !! so is this change in a svn? which one? or we have to download mp again?
 
» Reply to this comment...

Posted by gibman, on 01-10-2007, , Registered
2. ...
just grab latest developer snapshot of tvserver and tvplugin.
 
» Reply to this comment...

Posted by onewithtom, on 05-10-2007, , Guest
3. Network load
Great idea, I just have one small point. Would 1 'beat' every 5 seconds lead to many packets been sent and thus slow down the streaming?
 
» Reply to this comment...
» See all 2 replie(s)

Add your comment



mXcomment 1.0.5 © 2007-2008 - visualclinic.fr
License Creative Commons - Some rights reserved
Last Updated ( Tuesday, 25 September 2007 )
 






Status Overview

MediaPortal 1:
- Version: 1.0 RC2
- Status: featurefreeze
TV-Server:
- Version: 1.0 RC2
- Status: featurefreeze
MediaPortal 2:
- Version: tech-demo
- Status: in development
Changelogs:
- MediaPortal 1
- TV-Server
- Installer - DeployTool
Roadmaps:
- MediaPortal 1
- TV-Server
- Installer - DeployTool 

New Plugins/Skins

Sep.08 Black & White 1080 v0.7
Sep.08 Yahoo Music Videos
Sep.07 ASIO Music Player Plugin
Sep.06 Shoutcast Directory Plugin (MPI)
Sep.06 Shoutcast Directory Plugin

Random Screenshot


MediaPortal supports tv-cards from  

  • Digital Everywhere
  • Hauppauge
  • AVerMedia
  • Pinnacle
  • Technotrend
  • Twinhan
  • KNC One
  • Technisat
  • Dvico
  • FlyTV
  • and many more
MediaPortal, your digital video recorder - 2008 SourceForge.net Logo