pdmangel / node-red-contrib-openhab2

Other
20 stars 14 forks source link

Upgraded node-red 0.20 crashes #36

Closed guardiande closed 5 years ago

guardiande commented 5 years ago

I just upgraded from 0.19.6 to 0.20 and node red crashed with this exception:

14 Mar 08:39:04 - [red] Uncaught Exception:
14 Mar 08:39:04 - TypeError: Converting circular structure to JSON
    at JSON.stringify (<anonymous>)
    at getStateOfItems (/home/nodered/.node-red/node_modules/node-red-contrib-openhab2/77-openhab2.js:100:50)
    at EventSource.node.es.onopen (/home/nodered/.node-red/node_modules/node-red-contrib-openhab2/77-openhab2.js:148:14)
    at EventSource.emit (events.js:182:13)
    at _emit (/home/nodered/.node-red/node_modules/@joeybaker/eventsource/lib/eventsource.js:209:17)
    at ClientRequest.<anonymous> (/home/nodered/.node-red/node_modules/@joeybaker/eventsource/lib/eventsource.js:136:7)
    at Object.onceWrapper (events.js:273:13)
    at ClientRequest.emit (events.js:182:13)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:556:21)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:109:17)
    at Socket.socketOnData (_http_client.js:442:20)
    at Socket.emit (events.js:182:13)
    at addChunk (_stream_readable.js:283:12)
    at readableAddChunk (_stream_readable.js:264:11)
    at Socket.Readable.push (_stream_readable.js:219:10)
    at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)

Uncommenting line 100 in node-red-contrib-openhab2/77-openhab2.js solves the problem for the moment:

function getStateOfItems(config) {
    // node.log("getStateOfItems : config = " + JSON.stringify(config));

Not sure if my OpenHAB or Node Red flow setup is somehow special that it contains circles.

coolduke666 commented 5 years ago

... same problem here :(

snoekieboe commented 5 years ago

I have the same problem here:

I upgraded my Node-Red install to version 0.20.2 and now it's constantly restarting or crashing with the following error:

18 Mar 14:49:50 - TypeError: Converting circular structure to JSON at JSON.stringify () at getStateOfItems (/usr/lib/node_modules/node-red-contrib-openhab2/77-openhab2.js:100:50) at EventSource.node.es.onopen (/usr/lib/node_modules/node-red-contrib-openhab2/77-openhab2.js:148:14) at EventSource.emit (events.js:189:13) at _emit (/usr/lib/node_modules/node-red-contrib-openhab2/node_modules/@joeybaker/eventsource/lib/eventsource.js:209:17) at ClientRequest. (/usr/lib/node_modules/node-red-contrib-openhab2/node_modules/@joeybaker/eventsource/lib/eventsource.js:136:7) at Object.onceWrapper (events.js:277:13) at ClientRequest.emit (events.js:189:13) at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:556:21) at HTTPParser.parserOnHeadersComplete (_http_common.js:109:17) The specific case in which this error is reproducable:

Have Openhab nodes available (node-red-contrib-openhab2 - v1.1.4) Have huemagic nodes available that contain a Hue bridge configuration (node-red-contrib-huemagic - v1.9.0) Just having my openhab nodes in a flow does not cause any problems Just having the HueMagic nodes in a flow does not cause any problems

A soon as you make the combination, only when the hue bridge is configured, the above error is triggered.

I've also tried changing to other HUE nodes and this triggers the exact same behaviour.

Downgrading to version 0.18.x seems to resolve the issue.

Please point me in the right direction for a possible solution.

Thnx!

Node-red version: 0.20.2 node.js version: 10.15.3 OS: Ubuntu 18.04 LTS

knolleary commented 5 years ago

Working on a fix for Node-RED - expect 0.20.3 soon.

snoekieboe commented 5 years ago

Thats great news! any estimate on the ETA? Just for me to determine if it is worth using the workaround as described above.

thnx!

knolleary commented 5 years ago

ETA: either later today, or Wednesday.

snoekieboe commented 5 years ago

soon enough. many thanks!

slombard3000 commented 5 years ago

Just open the code (77-openhab2.js) and comment out the two log lines causing the issue. Works great after that. These are just log statement, line 100 and search for the other.

pdmangel commented 5 years ago

Fixed in version 1.1.5