Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebSocket exception crashes a node-red server #8

Closed
benkap opened this issue Jul 7, 2019 · 1 comment
Closed

WebSocket exception crashes a node-red server #8

benkap opened this issue Jul 7, 2019 · 1 comment

Comments

@benkap
Copy link

benkap commented Jul 7, 2019

First thank you for this great work! 90% of my home automation relay on this npm (using node-red-contrib-harmony in node-red) and it's a life saver.

From time to time (I couldn't find any specific trigger) an exception is thrown and kills node-red completely:

Error: Can't send data because WebSocket is not opened. at exports.throwIf (/share/CACHEDEV1_DATA/homes/admin/.node-red/node_modules/harmony-websocket/node_modules/websocket-as-promised/dist/index.js:3470:11) at WebSocketAsPromised.send (/share/CACHEDEV1_DATA/homes/admin/.node-red/node_modules/harmony-websocket/node_modules/websocket-as-promised/dist/index.js:554:7) at Timeout._interval.setInterval [as _onTimeout] (/share/CACHEDEV1_DATA/homes/admin/.node-red/node_modules/harmony-websocket/lib/harmony-websocket.js:136:59) at ontimeout (timers.js:475:11) at tryOnTimeout (timers.js:310:5) at Timer.listOnTimeout (timers.js:270:5)

At first I thought that i used too many "Harmony-Observe" nodes since the harmony hub is really not that reliable and maybe too many open sockets start some snowball and crashes, but after re-design all my flows to use only one main "Harmony-Observe" node-red still crashes (at least once a day or two).

I am using node 8.9.4 and node-red 0.20.6 but on ARM system (Qnap TS-431p).

I don't care about the exception (and probably the Harmony hub is really not open) but since it kill node-red it's a bugger issue.
I wasn't sure if to open on node-red-contrib-harmony repo since the exception is more related to harmony-websocket but maybe node-red-contrib-harmony should handle the exception better so let me know if to move this to node-red-contrib-harmony repo.

What do you think?

@lopelex lopelex closed this as completed in 3995c3e Jul 8, 2019
@lopelex
Copy link
Owner

lopelex commented Jul 8, 2019

Thanks for the hint.
It is probably not always an onClose event triggered by websocket-as-promised.
A simple try catch should be the easiest solution here.
see 3995c3e#diff-c8eab4317301da541e2bbd5a305d145fR136

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants