e-mcgee / paradox_platform

Paradox alarm homebridge platform
25 stars 6 forks source link

Random Crushing #23

Closed deon-wentzel closed 6 years ago

deon-wentzel commented 6 years ago

Hi,

I see you are working on Random Crushing issues, I am get the following crushes, are they related

ypeError: Cannot read property 'log' of null at Timeout._onTimeout (/usr/local/lib/node_modules/homebridge-paradox-securitysystem/index.js:458:62) at ontimeout (timers.js:475:11) at tryOnTimeout (timers.js:310:5) at Timer.listOnTimeout (timers.js:270:5) /usr/local/lib/node_modules/homebridge-paradox-securitysystem/index.js:1371 alarm[i].accessory.securitysystemService.getCharacteristic(Characteristic.SecuritySystemAlarmType).updateValue(alarmtype);
^

TypeError: Cannot read property 'accessory' of undefined at Timeout._onTimeout (/usr/local/lib/node_modules/homebridge-paradox-securitysystem/index.js:1371:38) at ontimeout (timers.js:475:11) at tryOnTimeout (timers.js:310:5) at Timer.listOnTimeout (timers.js:270:5) /usr/local/lib/node_modules/homebridge-paradox-securitysystem/index.js:1371 alarm[i].accessory.securitysystemService.getCharacteristic(Characteristic.SecuritySystemAlarmType).updateValue(alarmtype);
^

TypeError: Cannot read property 'accessory' of undefined at Timeout._onTimeout (/usr/local/lib/node_modules/homebridge-paradox-securitysystem/index.js:1371:38) at ontimeout (timers.js:475:11) at tryOnTimeout (timers.js:310:5) at Timer.listOnTimeout (timers.js:270:5) /usr/local/lib/node_modules/homebridge-paradox-securitysystem/index.js:1371 alarm[i].accessory.securitysystemService.getCharacteristic(Characteristic.SecuritySystemAlarmType).updateValue(alarmtype);
^

TypeError: Cannot read property 'accessory' of undefined at Timeout._onTimeout (/usr/local/lib/node_modules/homebridge-paradox-securitysystem/index.js:1371:38) at ontimeout (timers.js:475:11) at tryOnTimeout (timers.js:310:5) at Timer.listOnTimeout (timers.js:270:5) /usr/local/lib/node_modules/homebridge-paradox-securitysystem/index.js:1371 alarm[i].accessory.securitysystemService.getCharacteristic(Characteristic.SecuritySystemAlarmType).updateValue(alarmtype);
^

e-mcgee commented 6 years ago

OK great thanks. I will investigate. I also get random crashes so will see if i can identify cause.

e-mcgee commented 6 years ago

Hi, I think I solved it. It seems like sometimes the event info received form the alarm is not correct. I actually need to implement code to verify the checksum of the info before acting on it but have not yet managed to get that right. My previous attempts have not worked. Anyway, this faulty info causes an unused zone to be referenced which I did not previously check for in my code, so it references a "null" accessory which causes the crash. I now check for the "null" value in this particular part of the code before doing anything so it should not crash. I published v330. Lets test it to see if things improve.

deon-wentzel commented 6 years ago

OKay installing now..

deon-wentzel commented 6 years ago

I received the following error after and hour or two

/usr/local/lib/node_modules/homebridge-paradox-securitysystem/index.js:457 zones[receivebuffer[24]-1].debounce = false; ^

TypeError: Cannot set property 'debounce' of undefined at Timeout._onTimeout (/usr/local/lib/node_modules/homebridge-paradox-securitysystem/index.js:457:61) at ontimeout (timers.js:475:11) at tryOnTimeout (timers.js:310:5) at Timer.listOnTimeout (timers.js:270:5)

e-mcgee commented 6 years ago

I had the same. Made another change as I think because the zone info received is incorrect and out of bounds of the array (must be between 1 and 32) it is causing the crash. I built in a check to confirm if the value is in bounds. I am running at the moment so hopefully is solving the crash. I am busy developing the checksum calculation and will be testing in the next while. Until that works hopefully the crashing is now being prevented. New version is v336.

deon-wentzel commented 6 years ago

Hi,

To provide you with a update, after installing v336 I get the following same error

/usr/local/lib/node_modules/homebridge-paradox-securitysystem/index.js:486 zones[receivebuffer[24]-1].debounce = false; ^

TypeError: Cannot set property 'debounce' of undefined at Timeout._onTimeout (/usr/local/lib/node_modules/homebridge-paradox-securitysystem/index.js:486:65) at ontimeout (timers.js:475:11) at tryOnTimeout (timers.js:310:5) at Timer.listOnTimeout (timers.js:270:5)

e-mcgee commented 6 years ago

Hi Deon, mine is running stable for the last 24 hours. I will look into yours and it is within the same section where I now test to make sure the array out of bounds does not happen, and where I check that the accessory is not referenced when it points to null to prevent these crashes. Is it possible to post me your config.json?

deon-wentzel commented 6 years ago

Hi, Please see below, I am posting the Paradox section ONLY, is that okay? Please see attached file.

e-mcgee commented 6 years ago

That is fine. It looks correct. Mine has been running for 48 hours without a crash with the checks I built in before. I am thus a bit worried about your's still failing and hence why I suspected something wrong in your config. However, it does not seem the case. I managed to get the checksum working. I now only parse a message when the checksum is OK. Maybe give this one a try. v342

deon-wentzel commented 6 years ago

Hi,

So the office has been running with successfully for the last 24 hours. Anyway I have upgrade both home and office, and reset the log files. Will keep you posted...

e-mcgee commented 6 years ago

I had one crash this morning. It was when I opened it via normal remote and alarm not armed. However this did not repeat the rest of the day with gate and garage opening many times.

deon-wentzel commented 6 years ago

I received this crash from the office log files, @ 17:03 yesterday, please see below

buffer.js:183 throw new TypeError(kFromErrorMsg); ^

TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object. at Function.Buffer.from (buffer.js:183:11) at Object.from (/usr/local/lib/node_modules/homebridge/node_modules/buffer-shims/index.js:53:19) at StreamController._handleSelectedStreamConfigurationWrite (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/StreamController.js:281:25) at Characteristic.SelectedRTPStreamConfiguration. (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/StreamController.js:262:12) at emitMany (events.js:147:13) at Characteristic.SelectedRTPStreamConfiguration.emit (events.js:224:7) at Characteristic.SelectedRTPStreamConfiguration.Characteristic.setValue (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Characteristic.js:311:10) at Accessory. (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:867:22) at Array.forEach () at Accessory._handleSetCharacteristics (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:807:8) /usr/local/lib/node_modules/homebridge-paradox-securitysystem/index.js:1329 alarm[i].accessory.securitysystemService.getCharacteristic(Characteristic.SecuritySystemAlarmType).updateValue(alarmtype);
^

TypeError: Cannot read property 'accessory' of undefined at Timeout._onTimeout (/usr/local/lib/node_modules/homebridge-paradox-securitysystem/index.js:1329:42) at ontimeout (timers.js:475:11) at tryOnTimeout (timers.js:310:5) at Timer.listOnTimeout (timers.js:270:5)

deon-wentzel commented 6 years ago

BTY, I have one PGM connected to the Paradox System at the Office, but it is not configured on Homebridge. I only have the Alarm with motion sensors active on Homebridge @ the Office.

AT Home, the Homebridge has not crushed yet since the upgrade.

But!! Something strange I am experiencing when I automated the Gate and the Garage door via GPS proximity, when the automation runs, it seems to disable the remote functions after the automation is completed, I had to disable and enable, using the Control switch after which all function reverted normal.

e-mcgee commented 6 years ago

For the crash I think there is an issue with the alarmtype variable that may not be initialised in some instances. I removed the code for now as it does not really do anything sensible yet. So hopefully solves that one. v345. Mine is also been running stable since the last single crash.

e-mcgee commented 6 years ago

On the PGM issue can you check what is logged at the time. I have had issues with wireless supervision failure messages before with similar behaviour but in my case only on one of the PGM's. In my case I could see wireless supervision failure message being sent back from the alarm which I log to the console. You may not be able to find the message now but if it happens again note the time and then go look in the log output to see if you see any such message coming back from the alarm.

deon-wentzel commented 6 years ago

Hi

I will upgarde and keep posted

deon-wentzel commented 6 years ago

I am logging to a file, i will post the info shortly

deon-wentzel commented 6 years ago

Hi, please see attached, the error log file was saved at 17:05. The attached file is with debug for that minute, you see where the system restarts. Crash-Office.txt

deon-wentzel commented 6 years ago

The below happen this morning, a remote was used on the WIRELESS PGM, just before I used Home App to open the gate on the same PGM, the gate would not open, I had to switch the Control off and then on, in The Home App before it worked again..Similar to yours...

/usr/local/lib/node_modules/homebridge-paradox-securitysystem/index.js:485 zones[receivebuffer[24]-1].debounce = false; ^

TypeError: Cannot set property 'debounce' of undefined at Timeout._onTimeout (/usr/local/lib/node_modules/homebridge-paradox-securitysystem/index.js:485:69) at ontimeout (timers.js:475:11) at tryOnTimeout (timers.js:310:5) at Timer.listOnTimeout (timers.js:270:5) /usr/local/lib/node_modules/homebridge-paradox-securitysystem/index.js:485 zones[receivebuffer[24]-1].debounce = false; ^

TypeError: Cannot set property 'debounce' of undefined at Timeout._onTimeout (/usr/local/lib/node_modules/homebridge-paradox-securitysystem/index.js:485:69) at ontimeout (timers.js:475:11) at tryOnTimeout (timers.js:310:5) at Timer.listOnTimeout (timers.js:270:5)

e-mcgee commented 6 years ago

Hi Deon, the error seems to happen during the timeout of the debounce. I think what happens is that the index variable changes during the debounce timeout and then when the callback happens the variable is not pointing to the correct zone index which causes the crash. I now pass the zone being debounced as a variable to the callback function which I defined separately to try to resolve the issue. Lets test. v350 available.

e-mcgee commented 6 years ago

The reason why it runs fine in my case most of the time is because I have zero debounce on most zones. I seem to get it only for zones with a lengthy timeout such as my gate and garagedoor. Your's is also with PGM so most probably the same.

deon-wentzel commented 6 years ago

Okay, I have updated, cleared the logs, will keep you posted.

deon-wentzel commented 6 years ago

It seems to be working thanks!!!