With the impending release of media portal 1.6 (and so probably a new tvserver plugin) is it possible to add a basic heartbeat / keepalive so that it can be aware when an xbmc client has crashed while watching live TV?
The current behaviour seems to be that it isn't aware the client has died so the tvserver carries on streaming (which basically holds a lock on the tuner).
Even when the client comes back online it doesn't seem to be able to regain ownership of the lock tuner.. The only way to free the device is restart the mepo tvservice or go into the tvserver configuration and use manual control.
Either way isn't really wife/kid friendly ;-)

If the tvserver could notice the client has disconnected and just stop the tuned channel (as long as no other clients are using it) then it would be a great addition.

The current behavior is that the TVServerXBMC plugin will stop the active timeshift when the client properly closes the connection.
A new connection from the same IP-address is still seen as a new user because you could watch two different channels (e.g. VLC and XBMC) on the same machine.

A crash somehow does not result in a proper connection shutdown in your case (it does here, just tried it), so the timeshift will continue. The only way to solve it is indeed with a heartbeat/keepalive.
I've done a few quick tests and I can probably fix this completely at the TVServerXBMC side alone by looking at the regular "GetSignalQuality" calls which can also be seen as heartbeart/keepalive calls.

Ok, I've just uploaded a 1.6.0 version of the TVServerXBMC plugin with the heartbeat addition.
It will only work with the following setting in XBMC enabled:
Settings\Live-TV\Playback\Show Signal quality.

This setting asks the backend for the signal quality and it will automatically be used as keepalive. Disabling this setting also disables the keepalive currently because I haven't updated the PVR addon itself yet...