Node-RED crash.es due to zlib error

Hi all!

For some reason i cannot know why, my node-red instance crashes untipically an the only error i can see at logs are:

24 Jun 04:22:13 - [red] Uncaught Exception:
24 Jun 04:22:13 - TypeError: Cannot read property 'write' of null
at Zlib.callback (zlib.js:499:33)

Please, I have no idea why and the new logs when I started again are normal. There no more infos about it.

What it could be, please?

Thank you all!

Did node-red function properly before ?
If not, which node and npm versions and node-red version are you using ?
If yes, did you install a new node recently ?

Google suggests this may be an old nodejs issue, so, as @bakman2 suggests tell us the versions of everything and tell us what OS/hardware you are running on please.
You can get the nodejs version using
node -v
but possibly even better would be to show us the startup log you get when starting node-red. That is the log starting with the Welcome to node red message.

Hey there @bakman2 and @Colin!

Thanks!

node -v
v8.16.0

npm -v
6.4.1

Node-RED start Log:

Node-RED service stop: Thu Jun 25 14:40:22 -03 2020

Node-RED service start: Thu Jun 25 14:40:22 -03 2020
25 Jun 14:40:23 - [info]

Welcome to Node-RED

25 Jun 14:40:23 - [info] Node-RED version: v0.17.5
25 Jun 14:40:23 - [info] Node.js version: v8.16.0
25 Jun 14:40:23 - [info] Linux 4.4.0-178-generic x64 LE
25 Jun 14:40:23 - [info] Loading palette nodes
{ Error: Cannot find module '../build/Release/bson'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object. (/home/smartcampus/.node-red/node_modules/bson/ext/index.js:15:10)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3) code: 'MODULE_NOT_FOUND' }
25 Jun 14:40:26 - [warn] [mosca in] Deprecated call to RED.runtime.nodes.registerType - node-set name must be provided as first argument
25 Jun 14:40:26 - [info] Dashboard version 2.19.4 started at /ui
25 Jun 14:40:27 - [warn] ------------------------------------------------------
25 Jun 14:40:27 - [warn] [rpi-gpio] Info : Ignoring Raspberry Pi specific node
25 Jun 14:40:27 - [warn] ------------------------------------------------------
25 Jun 14:40:27 - [info] Settings file : /home/smartcampus/.node-red/settings.js
25 Jun 14:40:27 - [info] User directory : /home/smartcampus/.node-red
25 Jun 14:40:27 - [info] Flows file : /home/smartcampus/.node-red/flows_smartcampus2017.json
25 Jun 14:40:27 - [info] Server now running at https://127.0.0.1:1880/
25 Jun 14:40:27 - [info] Starting flows
25 Jun 14:40:29 - [info] [udp in:1907e2fa.4e6ded] udp listener at 0.0.0.0:2000
25 Jun 14:40:29 - [info] [tcp in:fdd631fe.3541e] listening on port 3000
25 Jun 14:40:29 - [info] [tcp in:66859c7c.10c7c4] listening on port 3100
25 Jun 14:40:29 - [info] [tcp in:7674bac8.c40334] listening on port 3300
25 Jun 14:40:29 - [info] [udp in:bb409157.a83e7] udp listener at 0.0.0.0:2100
25 Jun 14:40:29 - [info] [udp in:55b9191.da5dde8] udp listener at 0.0.0.0:2200
25 Jun 14:40:29 - [info] [udp in:b726bc12.c4a0f] udp listener at 0.0.0.0:2300
25 Jun 14:40:29 - [error] [json:cacff221.e572e8] Unexpected token s in JSON at position 0
25 Jun 14:40:29 - [info] [mqtt-broker:8bf3a4a0.9adb4] Connected to broker: mqtt://<HOST_NOT_SHOWN>:1883
25 Jun 14:40:29 - [info] [mqtt-broker:774b558c.e52fbc] Connected to broker: mqtt://<HOST_NOT_SHOWN>:1883
25 Jun 14:40:29 - [info] [mqtt-broker:c78b6667.8f2ab] Connected to broker: tccOrgaos@mqtt://<HOST_NOT_SHOWN>:1883
25 Jun 14:40:29 - [info] [mqtt-broker:6b6fd295.b2d77c] Connected to broker: mqtt://<HOST_NOT_SHOWN>:1883
25 Jun 14:40:29 - [info] [mqtt-broker:921ad3b8.77ee8] Connected to broker: edclaudio@mqtt://<HOST_NOT_SHOWN>:1883
25 Jun 14:40:29 - [info] [mqtt-broker:1e511942.bf7247] Connected to broker: mqtt://<HOST_NOT_SHOWN>:1883
25 Jun 14:40:29 - [info] [mqtt-broker:5b6bbc5a.91a354] Connected to broker: tcccivil@mqtt://<HOST_NOT_SHOWN>:1883
25 Jun 14:40:29 - [info] [mqtt-broker:c7a7f08d.0b1] Connected to broker: fernando@mqtt://<HOST_NOT_SHOWN>:1883
25 Jun 14:40:29 - [info] [mqtt-broker:171149.fafddeb7] Connected to broker: tccSplit2018@mqtt://<HOST_NOT_SHOWN>:1883
...

I have updated node-red-dashboard for about 2 month ago to the latest fot that time: v2.19.4

Maybe it helps :slight_smile:

Well you have a couple of errors there that I would sort out first, in case the crash is a side effect of one of those.

Do you know what is using the bson module? I don't think it is one of the standard modules included. If you don't know then first look in package.json and see if it is mentioned there. If not then look in package-lock.json, where you should be able to work out which node-red node include it.

That is an error in a JSON node complaining about the data it is being passed. You can find the node in the node-red editor by using the Search feature and searching for the node id which is cacff221.e572e8

Next I would make sure that all the nodes you use are up to date, you can see in Manage Palette the nodes that can be updated.

If after all that it is still failing then I think I would upgrade nodejs to version 12.x

Not sure Node-RED version: v0.17.5 will work with nodejs V12 (could be wrong - but I seem to remember issues of using nodejs v12 with older versions of node-red)

Indeed - should be no need to change node.js version (yet) - that will possibly confuse things further.... I do notice however that one of the errors refers to mosca... if this is being used as an mqtt broker then indeed it may be cleaner and more reliable to use the separate mosquitto broker package and keep that outside of Node-RED and remove that dependency.

Good point, hopefully the things I have suggested to do first will sort it anyway.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.