How Cynical Plugins deal with lost connections

Posted on
Sun May 12, 2013 4:31 pm
Perry The Cynic offline
Posts: 836
Joined: Apr 07, 2008

How Cynical Plugins deal with lost connections

Sometimes your network hick-ups and drops a connection. Sometimes a device glitches and stops talking. Sometimes things just get into a weird state, and while it's correct to complain, it's perhaps better to be resilient and try to clean up and try again. Let me tell you how the Cynical plugins deal with this.

Every Cynical plugin that manages network connections can tell that a connection to the device has failed. When it notices, it resets the connection, effectively restarting the device as if you had just turned it on. You will see an error message in the Indigo log to that effect. You should not see a network device getting "stuck" in some twilight state because of network trouble. This is automatic.

However, it's a peculiarity of the TCP protocol (which pretty much everything uses) that if neither side (Indigo or the device) has anything to say to the other, they won't actually say anything, and thus Indigo won't notice that a device connection has disappeared until it actually tries to talk to it again. Surprisingly often, the disconnects happen over night, and the sad realization hits you in the morning when you want something to work. For these cases, several of the Cynical plugins now sport a new checkbox in the device configuration, called Keepalive. If you turn on keepalives, the plugin will periodically say something to the device just as a means to say, "Are you still there, dear?" This means that with keepalive enabled, Indigo will find out pretty soon (within 15 minutes or so) if a connection has failed. This means your lost-at-night connection will have reset by the time you wake up in the morning.

Keepalive does one more thing: Since it's actually talking to the device and expecting an answer, it will catch any situation where the device just clams up and stops responding. That too is taken as an indication that something's wrong, so eventually the plugin will write an error message to the Indigo log and try to reset the device connection. This will even catch problems on serial connections. Don't expect miracles though - if the device is truly catatonic, the plugin's attempt to reset it will fail and you'll still have to pull the power or press some reset button or whatever it takes. But once you do, the plugin will re-establish its connection and start working again.

Keepalive applies only to Indigo devices that represent network or serial connections. Sub-devices (such as cameras for SecuritySpy, or zone devices of Denon receivers) "belong" to their main devices. When the main device resets, you'll get an error message for each sub-device, but they will reset along with their main device and become functional again.

At least that's the theory. Give it a spin if you like, and let me know how it works for you. It's obviously better to fix your networking problems rather than paper them over with reconnections, but it's better to fix problems than to just suffer. Keepalives are only sent (about once every 10 minutes) if nothing has been received from the device. They shouldn't cause you or your network any trouble.

Cheers
-- perry

Posted on
Wed May 15, 2013 10:45 am
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: How Cynical Plugins deal with lost connections

Well that update seems to have fixed my problem with intermittent disconnections of my GC-100.. 2 days since i installed the update and not one single queue issue, where as before they were happening every 3-4 hours (i can only suspect it was the device itself causing the issue as i tried swapping out everything else.. even installed a demo of Indigo on a completely brand new mac mini, setup a brand new company and hooked it to the GC100 using a brand new network cable.. same issue). So.. thanks… you’ve saved me lots of cash replacing it :D

Computer says no.

Posted on
Wed May 15, 2013 2:00 pm
wiery offline
Posts: 288
Joined: Jun 02, 2008
Location: Ireland

Re: How Cynical Plugins deal with lost connections

Looks like it has fixed my issues too with IP2IR devices. I had resorted to restarting the plugin every 30 minutes via schedule but so far so good with the new version and keepalive setting.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 4 guests