e-mcgee / paradox_platform

Paradox alarm homebridge platform
25 stars 6 forks source link

Segmentation fault: 11 Error #5

Closed deon-wentzel closed 6 years ago

deon-wentzel commented 7 years ago

Hi, I see the above error when I run launchctl to automatically run homebridge on boot, on a MAC, It runs for about 30sec and homebridge is restarted. I also experienced the above error when I was testing the Gate linked to PGM. If I run homebridge manually from the CLI, the error only happened once, or when I was testing the PGM and pressed the open gate icon on HOME APP a few times.

Have you experienced this error?

I have upgrade to the latest on nodes, npm and the plug-ins.

When I was running homebridge-paradox-security-system from mnrgreg, I never experienced this error.

deon-wentzel commented 7 years ago

Just to add to the above, when the system was armed, the above error happened, when homebridge was restarted the plug-in logs in and as soon as it get the status of the alarm "Armed" the error happens .

e-mcgee commented 7 years ago

Hi, I have not had this. I have not tested with a full arm. I have tested with Sleep Arm without issues. Can you confirm the Arm mode you used when getting this?

deon-wentzel commented 7 years ago

Hi, I am using "Away".

But this also happens when running homebridge using launchctl on boot and happened once when homebridge was started via the cli.

deon-wentzel commented 7 years ago

Okay, I have more information, it seems to be issue with MQTT and your plug-in, so when I run homebridge on the cli, and view the MQTT debug on node-red, I see the MQTT crash while homebridge is still running, then after while I get the error above.

Another note, If the the alarm is armed and the homebridge is started on the cli, the above error is received after the first login and this happens all the time, it you turn off the alarm and start homebridge on the cli, and then turn the alarm on, it works. until eventually the above error occurs. I am using the Home option to activate the alarm.

e-mcgee commented 7 years ago

I believe you may be running both the paradox plugin (mine and the MQTT plugin) communicating to the Paradox alarm. I had a similar problem a while back and eventually traced it to this. This causes my plugin to crash.

deon-wentzel commented 7 years ago

the MQTT I use for Sonoff Wifi Relays which switch the lights and the fans on or off, it does not talk to the paradox alarm...

deon-wentzel commented 7 years ago

I have moved the Paradox Alarm Plug-in to a different Mac, with nodejs, homebridge and homebridge-paradoxsytem ONLY and it is working... When will you resolve the issue with MQTT and the plug-in?

MnrGreg commented 7 years ago

@deon-wentzel I had a similar issue. @e-McGee uses a sleep timer which delays all Homebridge modules and likely causes your MQ heartbeat to expire and the consuming module to crash Homebridge. I increased the MQTT heartbeat time which resolved the issue. If I recall it was set to 10ms and I increased to 20ms.

Think is was Homebridge-MQTTSwitch I'll fork it.

Btw aren't Sonoff's are great!

Sent from my iPhone

On 11 May 2017, at 2:07 PM, deon-wentzel notifications@github.com wrote:

I have moved the Paradox Alarm Plug-in to a different Mac, with nodejs, homebridge and homebridge-paradoxsytem ONLY and it is working... When will you resolve the issue with MQTT and the plug-in?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

deon-wentzel commented 7 years ago

Thanks for the feed back.

I am not using the homebridge-mqttswitch, I replaced it with homebridge-mqtt-switch-tasmota. Let me have in this module..

Yeah, the Sonoff works well.

e-mcgee commented 7 years ago

I will look into the sleep timer to see if I can resolve the issue. I tuned the delays to improve the stability of the comms to the alarm.

Am waiting for my Sonoffs from China at the moment.

deon-wentzel commented 7 years ago

So I edited the file index.js in homebridge-mqtt-switch-tasmota and change the keep alive from 10 to 20 and it seems to be working.

MnrGreg what OS have you installed on the Sonoff, I find the tasmota, works well and includes OTA upgrades. It also allows changes to the WiFi, MQTT,etc..

MnrGreg commented 7 years ago

Yep, using Tasmota as well.

Sent from my iPhone

On 11 May 2017, at 9:10 PM, deon-wentzel notifications@github.com wrote:

tasmota

deon-wentzel commented 7 years ago

So, it ran for awhile until I had to open the gate which is connect to the pgm, homebridge displayed the following error.

TypeError: acc.log is not a function at Socket.client.on (/usr/local/lib/node_modules/homebridge-paradox-securitysystem/index.js:918:21) at emitOne (events.js:96:13) at Socket.emit (events.js:188:7) at emitErrorNT (net.js:1278:8) at _combinedTickCallback (internal/process/next_tick.js:74:11) at process._tickDomainCallback (internal/process/next_tick.js:122:9) at module.exports.runLoopOnce (/usr/local/lib/node_modules/homebridge-paradox-securitysystem/node_modules/deasync/index.js:65:11) at module.exports (/usr/local/lib/node_modules/homebridge-paradox-securitysystem/node_modules/deasync-promise/index.js:13:9) at module.exports.interval (/usr/local/lib/node_modules/homebridge-paradox-securitysystem/node_modules/system-sleep/module.js:17:56) at ParadoxAccessory.setAlarmState (/usr/local/lib/node_modules/homebridge-paradox-securitysystem/index.js:930:13) /usr/local/lib/node_modules/homebridge-paradox-securitysystem/index.js:918 acc.log('Error communicating with alarm - Disconnected from alarm');

e-mcgee commented 7 years ago

Hi,

I have a new version just published (v44) that has the Sleep function completely removed. I now only use Timers to implement the delays required for the Paradox commands to execute. Please let me know if this improved stability of the plugin when used with other plugins.

deon-wentzel commented 7 years ago

I ran it for and hour yesterday with no issues on v44, I had to remove it due to the PGM not working while using the remotes.

e-mcgee commented 7 years ago

Hi, have been away for a while. Just worked through this again and think I found the reason for the segmentation fault. I pass the accessory handle to the functions that control the alarm, and the callback functions that react to the messages when communicating through the socket to the alarm is nto in scope of this handle. Each time I send a log message using this handle it causes the problem. I changed all to use "self" instead and think this should solve the segmentation fault. V48 has this fix in.

e-mcgee commented 7 years ago

OK, tested v48 and it did not work. After some more troubleshooting I decided to abandon trying to log from the callback functions in the socket communication altogether. v50 now has this fixed. I tested and it seems to be running fine now.

deon-wentzel commented 6 years ago

This error does not happen anymore...

deon-wentzel commented 6 years ago

Thanks for the great plug-in