Heartbeats - a way for TVserver to keep track of live and dead clients .

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 

 

About The Project

The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

In reaching this goal we are working every day to make sure our software is one of the best.

         

Quick Navigation

  • Home
  • About MediaPortal
  • Bugtracker
  • Download
  • This email address is being protected from spambots. You need JavaScript enabled to view it.
  • Our Partners

Support MediaPortal!

The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

Care to support our work with a few bucks? We'd really appreciate it!


We use cookies

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). Cookies and personal data may be used for ads personalization. You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.