[mythtv] What happens with connections when a client dies?

Holger Buchfink avalanche at beyondmonkey.com
Thu Feb 24 16:44:05 UTC 2005


David Whyte wrote:
> I have noticed that the proper way to close the socket is to call the
> DONE command over the MythProtocol, but I was wandering what effects
> this would have if it weren't done *everytime* (such as when the
> frontend dies in a nasty way).  Do the open connections get 'garbage
> collected' after a certain period of time?

Depends. There really is no short answer. There's TCP, your client's
kernel (sockets), Qt and Myth. The outcome is dependent on what goes
wrong and when.

If the client (Myth) dies and it's kernel doesn't, the kernel will
close the socket and all is well.

If the kernel dies, (or you pull the network cable on the client)
and there is something on the wire, in this case TCP is moving
something, TCP should timeout and close the connection.

Same as above, the kernel dies etc, but nothing is on the wire and
the server or client don't try to send anything. In this case,
the socket can stay open unnoticed.

Sockets do provide a keep-alive that lets TCP periodically, default
is 2 hours check the connection, if nothing happens. Qt doesn't implement
this option, probably since it's platform dependent and not reliable.
Myth backend does not currently check the connections, either. Some of
it's connections only send stuff on client request, so I think it is
currently possible that a socket can stay open unnoticed.

Holger


More information about the mythtv-dev mailing list