NRCHKB / node-red-contrib-unifi-os

Nodes to access UniFi data using endpoints and websockets
Apache License 2.0
28 stars 1 forks source link

"Websocket is not open" crash. #75

Closed Supergiovane closed 5 months ago

Supergiovane commented 5 months ago

Hi, at first again thank you for such a great node. Today i noticed a restart of node-red, so i checked the log and saw this:

(node:343) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 pong listeners added to [WebSocket]. Use emitter.setMaxListeners() to increase limit
(node:343) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 pong listeners added to [WebSocket]. Use emitter.setMaxListeners() to increase limit
(node:343) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 pong listeners added to [WebSocket]. Use emitter.setMaxListeners() to increase limit
(node:343) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 pong listeners added to [WebSocket]. Use emitter.setMaxListeners() to increase limit
(node:343) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 pong listeners added to [WebSocket]. Use emitter.setMaxListeners() to increase limit
(node:343) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 pong listeners added to [WebSocket]. Use emitter.setMaxListeners() to increase limit
(node:343) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 pong listeners added to [WebSocket]. Use emitter.setMaxListeners() to increase limit
28 Jun 09:34:41 - [red] Uncaught Exception:
28 Jun 09:34:41 - [error] Error: WebSocket is not open: readyState 0 (CONNECTING)
    at WebSocket.ping (/home/pi/.node-red/node_modules/node-red-contrib-unifi-os/node_modules/ws/lib/websocket.js:354:13)
    at SharedProtectWebSocket.<anonymous> (/home/pi/.node-red/node_modules/node-red-contrib-unifi-os/build/SharedProtectWebSocket.js:74:72)
    at Generator.next (<anonymous>)
    at fulfilled (/home/pi/.node-red/node_modules/node-red-contrib-unifi-os/build/SharedProtectWebSocket.js:5:58)
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Failed with result 'exit-code'.
nodered.service: Consumed 17min 22.763s CPU time.

Maybe you could check that anonymous function in the SharedProtectWebSocket.

Node: 16.14.2 Node-Red: 3.1.3 Debian OS

I'm running an UDM-SE v4.0.6 (early access), Network 8.3.20, Protect 4.0.33

Thanks!

crxporter commented 5 months ago

Which hardware is running your Unifi? Do you have Protect?

@marcus-j-davies should be able to take a look later today?

Supergiovane commented 5 months ago

Hi Sorry, i'm running an UDM-SE v4.0.6 (early access), Network 8.3.20, Protect 4.0.33

marcus-j-davies commented 5 months ago

This is already reported.

https://github.com/NRCHKB/node-red-contrib-unifi-os/issues/72

it should hopefully be fixed when 1.1.0 is release

Supergiovane commented 4 months ago

Hi again I'm running the 1.1.0-beta1 and, unfortunately, the issue still persist:

6 Jul 14:55:50 - [red] Uncaught Exception:
6 Jul 14:55:50 - [error] Error: WebSocket was closed before the connection was established
    at WebSocket.close (/home/pi/.node-red/node_modules/node-red-contrib-unifi-os/node_modules/ws/lib/websocket.js:285:7)
    at SharedProtectWebSocket.disconnect (/home/pi/.node-red/node_modules/node-red-contrib-unifi-os/build/SharedProtectWebSocket.js:72:64)
    at SharedProtectWebSocket.<anonymous> (/home/pi/.node-red/node_modules/node-red-contrib-unifi-os/build/SharedProtectWebSocket.js:99:30)
    at Generator.next (<anonymous>)
    at /home/pi/.node-red/node_modules/node-red-contrib-unifi-os/build/SharedProtectWebSocket.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/home/pi/.node-red/node_modules/node-red-contrib-unifi-os/build/SharedProtectWebSocket.js:4:12)
    at /home/pi/.node-red/node_modules/node-red-contrib-unifi-os/build/SharedProtectWebSocket.js:98:57
    at /home/pi/.node-red/node_modules/async-mutex/lib/Mutex.js:25:66
    at Semaphore.<anonymous> (/home/pi/.node-red/node_modules/async-mutex/lib/Semaphore.js:44:46)
    at step (/home/pi/.node-red/node_modules/async-mutex/node_modules/tslib/tslib.js:195:27)
    at Object.next (/home/pi/.node-red/node_modules/async-mutex/node_modules/tslib/tslib.js:176:57)
    at fulfilled (/home/pi/.node-red/node_modules/async-mutex/node_modules/tslib/tslib.js:166:62)
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Failed with result 'exit-code'.
nodered.service: Consumed 10min 47.545s CPU time.
marcus-j-davies commented 4 months ago

@crxporter, Are you seeing this also?

Supergiovane commented 4 months ago

Hi Other than the "WebSocket was closed before the connection was established", i've trapped an error like "Websocket already open" or similar. My NR crashed and had to restore a backup, so the log is vanished and i cannot be more detailed about that. I'm still on 1.1.0-beta1 :-)