Opened 12 years ago

Closed 12 years ago

#7839 closed enhancement (fixed)

Add TCP keepalive to MythSocket connections

Reported by: Jeff Lu <jll544@…> Owned by: Isaac Richards
Priority: minor Milestone: unknown
Component: MythTV - General Version: head
Severity: medium Keywords:
Cc: Ticket locked: no


Attached patch adds TCP keepalive to MythSocket? connections. Doing so ensures that idle sockets are closed after the connection is broken.

Two examples where keepalives allow Myth to recover gracefully: 1) Master backend has HW crash or reboot, and slaves never reconnect because their MBE sockets never closed. 2) Frontend watching LiveTV has HW crash or reboot, and backend never stops recording LiveTV because control socket never closed.

By default, keepalives start after 120 idle minutes, so recovery could take at least that long (Linux defaults add up to ~137 minutes). Keepalive timing is configurable but not in a consistent way across different platforms. For linux:

Attachments (1)

7839-tcp_keepalive.patch (3.2 KB) - added by Jeff Lu <jll544@…> 12 years ago.

Download all attachments as: .zip

Change History (2)

Changed 12 years ago by Jeff Lu <jll544@…>

Attachment: 7839-tcp_keepalive.patch added

comment:1 Changed 12 years ago by markk

Resolution: fixed
Status: newclosed

(In [23397]) Add TCP keepalive to MythSocket? connections. Patch from Jeff Lu with small modification suggested by Paul Kendall.

In summary, broken connections should now be closed gracefully after a system specific timeout. For improved usability the timeout should probably be reduced.

I think this should still be the fallback for broken connections - a complete solution would include a 'hearbeat' monitor between frontends/backends, as has been proposed before, that would detect broken connections in a timely manner (although, thinking about it, I'm not sure what additional functionality that provides!).

Closes #7839. See the original ticket for full details.

Note: See TracTickets for help on using tickets.