kw123 / Hue-Lights-Indigo-plugin

Philips Hue control from Indigo
MIT License
7 stars 11 forks source link

Network connection warning #12

Open indigo-jay opened 2 years ago

indigo-jay commented 2 years ago

I started seeing this in the event log, probably need to figure out what's causing it. If it's somewhat normal in operation, we probably shouldn't log it as a warning.

   Hue Lights Warning              '("Connection broken: error(54, 'Connection reset by peer')", error(54, 'Connection reset by peer'))'
generate @line 671: 'raise ChunkedEncodingError(e)'
kw123 commented 2 years ago

looking at “ChunkedEncodingError” posts, it looks like a requests error.. but the line 671 is no where near any requests statement

On May 13, 2022, at 18:11, karl wachs @.***> wrote:

Jay,

I don’t get that one, and line 671 is dev = indigo.device.create( protocol = indigo.kProtocol.Plugin, address = address, name = name, description = "", pluginId = self.pluginId, deviceTypeId = deviceTypeId, folder = hueFolderID, props = props <=== line 671 )

Don’t understand what is wrong, is that an indigo connection error?

Karl

On May 13, 2022, at 01:58, Jay Martin @. @.>> wrote:

I started seeing this in the event log, probably need to figure out what's causing it. If it's somewhat normal in operation, we probably shouldn't log it as a warning.

Hue Lights Warning '("Connection broken: error(54, 'Connection reset by peer')", error(54, 'Connection reset by peer'))' generate @line 671: 'raise ChunkedEncodingError(e)'

— Reply to this email directly, view it on GitHub https://github.com/IndigoDomotics/Hue-Lights-Indigo-plugin/issues/12, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEH2SNHZ3UQ4AG3BB3ILZKTVJWLLBANCNFSM5VZZROEQ. You are receiving this because you are subscribed to this thread.

indigo-jay commented 2 years ago

Yeah, because that error is being caught by someone/somewhere else and reformatted (rather than using the standard exception traceback) clearly it's not coming from line 671 in plugin.py. I'll track down where it's actually happening. He's got an old version of requests in there that appears to not be used, but he may also have some code that uses something in an older version of requests that the current version we're shipping does. I'll figure it out.

indigo-jay commented 2 years ago

I found the problem: it's in:

def exceptionHandler(self, level, exception_error_message, extraText=""):

Which tries to take the passed in exception and reformat the presentation. Unfortunately, it's not good enough to really track down where the exception is coming from. This is exactly why I discourage people from trying to reformat exceptions/stack traces - those are proven to have all the right information (including call stack with file names, line numbers, etc) and it's very quick and easy to see what's going on.

My recommendation is to remove all that custom exception formatting and just leave stack traces in using a separate self.logger.debug() call so users can just turn on debugging to get the information you need to track down the problem.

indigo-jay commented 2 years ago

BTW, still getting this error every 3 minutes 20 seconds (approximately). I have no idea why since the exception is getting swallowed so I have no idea where it's really happening in plugin.py.

kw123 commented 1 year ago

Jay,

I don’t get that one, and line 671 is dev = indigo.device.create( protocol = indigo.kProtocol.Plugin, address = address, name = name, description = "", pluginId = self.pluginId, deviceTypeId = deviceTypeId, folder = hueFolderID, props = props <=== line 671 )

Don’t understand what is wrong, is that an indigo connection error?

Karl

On May 13, 2022, at 01:58, Jay Martin @.***> wrote:

I started seeing this in the event log, probably need to figure out what's causing it. If it's somewhat normal in operation, we probably shouldn't log it as a warning.

Hue Lights Warning '("Connection broken: error(54, 'Connection reset by peer')", error(54, 'Connection reset by peer'))' generate @line 671: 'raise ChunkedEncodingError(e)'

— Reply to this email directly, view it on GitHub https://github.com/IndigoDomotics/Hue-Lights-Indigo-plugin/issues/12, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEH2SNHZ3UQ4AG3BB3ILZKTVJWLLBANCNFSM5VZZROEQ. You are receiving this because you are subscribed to this thread.

indigo-jay commented 1 year ago

I'm positive that you've made a ton of changes since I filed this bug in May, so your current line numbers will never match up. Based on the error, it seems quite likely it was happening when you are trying to connect to the hub over the network. But other than that, I can't help.

kw123 commented 1 year ago

Jay

def exceptionHandler(self, level, exception_error_message, extraText=""):

is not in the plugin anymore,

All exceptions are handled like this:

    except Exception:
        self.logger.error("", exc_info=True)

or

                except Exception:
                    self.indiLOG.log(30,”some text ", exc_info=True)
                    self.indiLOG.log(40,”some text ", exc_info=True)

with:

    self.indiLOG = logging.getLogger("Plugin")
    self.indiLOG.setLevel(logging.THREADDEBUG)
    self.indigo_log_handler.setLevel(logging.INFO)

re 90 seconds:
error messages for failure to connect to bridge are suppressed for 90 seconds before they are repeated . so the error will likely occur more frequently.

could you do : menu/ Print hue config data to log…/config, bridges config overview there you can see how the bridges are defined and if there are any orphans

Karl

On May 18, 2022, at 23:59, Jay Martin @.***> wrote:

def exceptionHandler(self, level, exception_error_message, extraText=""):