Page 1 of 1

random weird Error

Posted: Wed Nov 09, 2016 1:40 am
by skribb
This happens randomly, so I've no idea what to troubleshoot. All of a sudden the problem will stop appearing, and then come back again after weeks/months.

The plugin is autoremote, but it looks more like an EG error, doesn't it?

Image

Anyone know what this could be?

Re: random weird Error

Posted: Wed Nov 09, 2016 6:23 am
by kgschlosser
sure do, you have a socket connection that was dropped. it's from the plugin because it wasn't coded into the AutoRemote plugin to handle socket exceptions. it could be because of garbage data. or a timeout. our internet drops for a split second. i don't know exactly. would have to really investigate. you could set a timer to disable and re enable the plugin that will ensure that it will reconnect. see if you can isolate some kind of time pattern. that wya you know how long to set the timer out to

Re: random weird Error

Posted: Wed Nov 09, 2016 4:53 pm
by skribb
kgschlosser wrote:sure do, you have a socket connection that was dropped. it's from the plugin because it wasn't coded into the AutoRemote plugin to handle socket exceptions. it could be because of garbage data. or a timeout. our internet drops for a split second. i don't know exactly. would have to really investigate. you could set a timer to disable and re enable the plugin that will ensure that it will reconnect. see if you can isolate some kind of time pattern. that wya you know how long to set the timer out to
Interesesting, thanks for the input.

I'll try the timer thing out and see what happens.

When you say garbage data, what do you mean? That the message being sent/received becomes garbled somewhere along the way?

Re: random weird Error

Posted: Thu Nov 10, 2016 7:35 am
by kgschlosser
or if there is a eg.TriggerEvent event in the asyn handler and a character out of ordinal range is passed to the TriggerEvent. Meaning. a so called non readable character. i think the characters have to fall between something like 28 and 137 or some such thing. i would have to go and look. but out of a possible 255 ascii characters that's a pretty small window. and sometimes one manages it's way in there that in not between those 2 numbers and EG throws a fit. and because the asyn is set to catch errors. it does. but when it catches one it doesn't know what to do with. it just closes the socket and gives you some random socket error. I had to help someone deal with that horse potatoes of a problem with the broadcaster plugin. took a while to figure out what was doing it.

i will bet some of my pocket change that's what it is.

Re: random weird Error

Posted: Thu Nov 10, 2016 12:01 pm
by skribb
kgschlosser wrote:or if there is a eg.TriggerEvent event in the asyn handler and a character out of ordinal range is passed to the TriggerEvent. Meaning. a so called non readable character. i think the characters have to fall between something like 28 and 137 or some such thing. i would have to go and look. but out of a possible 255 ascii characters that's a pretty small window. and sometimes one manages it's way in there that in not between those 2 numbers and EG throws a fit. and because the asyn is set to catch errors. it does. but when it catches one it doesn't know what to do with. it just closes the socket and gives you some random socket error. I had to help someone deal with that horse potatoes of a problem with the broadcaster plugin. took a while to figure out what was doing it.

i will bet some of my pocket change that's what it is.
Yeah that sounds like a plausible scenario!

Re: random weird Error

Posted: Thu Nov 10, 2016 2:55 pm
by kgschlosser
if you look at the plugin code take a look see for a class that is a subclass of asyncore.dispatcher or the likes.. and in the method handle_accept or handle_read see if there are any triggerevent calls inside any of those methods. without it doing an ordinal check an ordinal check would look something like this

Code: Select all

suffix = list(suffix)

for letter in suffix:
    if 32 > ord(letter) > 127:
        suffix[suffix.index(letter)] = ''
i know 100% the top number is supposed to be 127. i think the bottom is 32 i don't recall honestly. but that will scan a dynamically generated suffix for a character that is outside of "readable" range. meaning it's not A-Z a-z all of your punctuation. so on and so forth. you can also use re and regular expression to do it. so look for that as well. but anything that takes any data received and puts it into an event without any exception handling is a sure fire way to cause this exact problem.


how i would usually code for this would be


Code: Select all

try:
    eg.TriggerEvent(suffix)
except:
    suffix = list(suffix)
    errorHex = []
    errorPositions = []
    errorSuffix = ''

    for i, letter in enumerate(suffix):
        if 32 > ord(letter) > 127:
            errorPositions.append(str(i))
            errorHex.append(hex(letter))
            letter = ' '
        errorSuffix += letter
    errorMessage = 'Received non printable character(s) in the data received.\nData: %s\nPosition(s): %s\nHex Code(s): %s' % (errorSuffix, ', '.join(errorPositions), ', '.join(errorHex))
    eg.PrintError(errorMessage)
    eg.PrintDebugNotice(errorMessage)

this way it will catch error then scan the suffix and look for the issue, if it finds a character out of sorts then to reformat the suffix removing the problem character and turning it into a hex code that you can use an ASCII char to determine what it is. and also have it send the output to the debug log file that way if you turn on debugging you can just let it do it's thing and look at it later (eg version 0.4 or earlier, debugging does not work properly in 0.5beta)

if you want to KISS it. take the handle_accept method and the handle_read methods and do this and you will get a print out of the actual error

Code: Select all

def handle_read(self, data):
    try:
        blah blah all the original code. just add the indent to each line.
    except:
        import traceback
        traceback.print_exc()
this will catch any exception. and print it out. without it getting caught by the asyn and the asyn closing the socket on ya and giving you some unrelated message


remember all code here is pseudo code and is for the general idea and not specifically designed to work in this specific problem/plugin. tho it should. besides the usual typo or syntax related problem related to my arthritic code

it looks as tho yours stems from the process_request_thread method. but who knows. you will have to get crosseyed looking at the source for the plugin to know exactly.