vanackej / risco-mqtt-local

Provide Risco alarm system integration to Home assistant using local TCP communication (no cloud required) and MQTT
MIT License
24 stars 11 forks source link

Cannot read properties of undefined (reading sybstring) at risco ... #4

Closed pergolafabio closed 2 years ago

pergolafabio commented 2 years ago

Hi

i rebooted my HassOS, and i noticed your addon was in a stopped state, sorry, i only have a screenshot of the issue, nog log .txt file

i think this one is related to your add-on? sorry for creating so many issues, but just posting issues/errors i have, i think its usefull for later when more and more people are using it

image

pergolafabio commented 2 years ago

happened again, little bit different :

6:29:08 PM RiscoCloud Socket Timeout.
TCP Socket Disconnected
Socket Error : Error [ERR_STREAM_WRITE_AFTER_END]: write after end
RiscoCloud Socket Error : Destroy RiscoCloud Socket due to Panel Socket Error
RiscoCloud Socket Closed.
/usr/src/app/node_modules/@vanackej/risco-lan-bridge/lib/RiscoChannels.js:885
                                if (!this.Socket.destroyed) {
                                                 ^
TypeError: Cannot read properties of undefined (reading 'destroyed')
    at Socket.<anonymous> (/usr/src/app/node_modules/@vanackej/risco-lan-bridge/lib/RiscoChannels.js:885:50)
    at Socket.emit (node:events:390:28)
    at TCP.<anonymous> (node:net:687:12)

i see a watchdog config option, what is it used for?

thnx

vanackej commented 2 years ago

I just released a new version with improved Timeout management, Please try it and let me know if you still have problems with it

pergolafabio commented 2 years ago

is this also related to this issue? will it restart the service? https://github.com/TJForc/risco-lan-bridge/issues/14 https://github.com/TJForc/risco-lan-bridge/issues/13

because it happens for me 1 time a day, then the panel is offline

gonna update it later and keep you posted

vanackej commented 2 years ago

It could/should improve reconnection when the panel is disconnected/reconnected. But for the proxy mode I don't really know as I don't use it and can't debug it.

Le sam. 4 déc. 2021 à 15:08, pergolafabio @.***> a écrit :

is this also related to this issue? will it restart the service? TJForc/risco-lan-bridge#14 https://github.com/TJForc/risco-lan-bridge/issues/14 TJForc/risco-lan-bridge#13 https://github.com/TJForc/risco-lan-bridge/issues/13

because it happens for me 1 time a day, then the panel is offline

gonna update it later and keep you posted

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/vanackej/risco-mqtt-local/issues/4#issuecomment-986033857, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAECPHLRDOJP4OU7ML7ZKU3UPIOFBANCNFSM5JGYNE2Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

pergolafabio commented 2 years ago

ok, updated , lets see what happens

pergolafabio commented 2 years ago

thnx!! :-)

pergolafabio commented 2 years ago

hmm, doesnt help for the socket :-(

if i stop and restart the docker for a second time, it fails with below

the problem is that it stays in that state forever ... is there a way to trigger a restart when that happens? because my panels drops from the cloud at this moment

if i do a 3th restart , when i wait for like 2-3 minutes, then it succeeds again

12/4/2021, 3:16:03 PM [info] Connecting to mqtt server: mqtt://localhost:1883
12/4/2021, 3:16:03 PM [info] Listening on IP :: and Port 33000
12/4/2021, 3:16:03 PM [info] Connected on mqtt server: mqtt://localhost:1883
12/4/2021, 3:16:45 PM [error] Socket Closed.
12/4/2021, 3:16:45 PM [error] TCP Socket Disconnected
12/4/2021, 3:16:55 PM [info] Listening on IP :: and Port 33000
12/4/2021, 3:17:04 PM [error] Command[01] Socket Destroyed while using it.
pergolafabio commented 2 years ago

hey @vanackej , the docker crashed again :-(

can you have a look at it?

12/5/2021, 9:48:40 AM [info] [Panel => MQTT] Published sensor status 0 on zone Keuken
12/5/2021, 9:48:40 AM [error] 9:48:40 AM RiscoCloud Socket Timeout.
12/5/2021, 9:48:40 AM [error] TCP Socket Disconnected
12/5/2021, 9:48:40 AM [error] Socket Error : Error [ERR_STREAM_WRITE_AFTER_END]: write after end
12/5/2021, 9:48:40 AM [error] RiscoCloud Socket Error : Destroy RiscoCloud Socket due to Panel Socket Error
12/5/2021, 9:48:40 AM [error] RiscoCloud Socket Closed.
/usr/src/app/node_modules/@vanackej/risco-lan-bridge/lib/RiscoChannels.js:888
                                if (!this.Socket.destroyed) {
                                                 ^
TypeError: Cannot read properties of undefined (reading 'destroyed')
    at Socket.<anonymous> (/usr/src/app/node_modules/@vanackej/risco-lan-bridge/lib/RiscoChannels.js:888:50)
    at Socket.emit (node:events:390:28)
    at TCP.<anonymous> (node:net:687:12)
vanackej commented 2 years ago

I just published a new version that should fix the crash (but not the original disconnection issue)

pergolafabio commented 2 years ago

ah cool! alltough it didnt happen that frequently

isnt there a way to implement in the addon some restart error of the service, when this error occurs?

https://github.com/TJForc/risco-lan-bridge/issues/13 or https://github.com/TJForc/risco-lan-bridge/issues/14

Already enabled the watchdog, but seems the docker doesnt crash i think its better todo restart based on those error events?

i think it it will stay happening when using proxy, maybe its cloud related, but it must be possible to intercept those exceotions? otherwise the panel is complete offline in HA , not a good solution then :-)

vanackej commented 2 years ago

I don't know why, but TJFrog choose to link Cloud socket and Panel socket lifecycle. I didn't read the full code for proxy mode, but I plan to rewrite it another way one day (no time for it at the moment). Hard to test for me again as I don't use proxy mode...

pergolafabio commented 2 years ago

Oh ok, ... You didn't pay anymore for the cloud?

vanackej commented 2 years ago

No, I don't want to pay for the cloud, and given the lack of security I discovered (virtually anyone can hijack communications between the panel and the cloud), I really prefer to disable it completely.

Le jeu. 9 déc. 2021 à 17:48, pergolafabio @.***> a écrit :

Oh ok, ... You didn't pay anymore for the cloud?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/vanackej/risco-mqtt-local/issues/4#issuecomment-990029184, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAECPHPQMLAN2N7ZKI7G52DUQDMVFANCNFSM5JGYNE2Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

pergolafabio commented 2 years ago

Ah ok, it's not as easy as search for that specific error in the script, and on that error do a restart :-)