Cyclical crashing

#1

I’m new to this and have been noodling around with a couple of Sonoff switches and MQTT.

The Sonoff nodes have been installed for some time now. Suddenly I’m getting cyclical crashing when Node-red starts. Here is the log…

pi@raspberrypi3:~ $ node-red-stop

Stop Node-RED

Use node-red-start to start Node-RED again
node-red-log
pi@raspberrypi3:~ $ node-red-log

nodered.service: Unit entered failed state.
nodered.service: Failed with result ‘exit-code’.
nodered.service: Service hold-off time over, scheduling restart.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.
30 Jun 10:16:09 - [info]
Welcome to Node-RED

30 Jun 10:16:09 - [info] Node-RED version: v0.18.7
30 Jun 10:16:09 - [info] Node.js version: v8.11.3
30 Jun 10:16:09 - [info] Linux 4.14.50-v7+ arm LE
30 Jun 10:16:10 - [info] Loading palette nodes
Stopping Node-RED graphical event wiring tool…
global Settings { uib_globalSettings: { debug: false },
userDir: ‘/home/pi/.node-red’,
httpNodeRoot: ‘/’ }
30 Jun 10:16:15 - [info] Dashboard version 2.9.4 started at /ui
30 Jun 10:16:16 - [warn] ------------------------------------------------------
30 Jun 10:16:16 - [warn] [node-red-contrib-moment2/moment] ‘moment’ already registered by module node-red-contrib-moment
30 Jun 10:16:16 - [warn] ------------------------------------------------------
30 Jun 10:16:16 - [info] Settings file : /home/pi/.node-red/settings.js
30 Jun 10:16:16 - [info] User directory : /home/pi/.node-red
30 Jun 10:16:16 - [warn] Projects disabled : editorTheme.projects.enabled=false
30 Jun 10:16:16 - [info] Flows file : /home/pi/.node-red/flows_raspberrypi3.json
Stopped Node-RED graphical event wiring tool.

My ignorant sense is that there is a simple fix. I’m hoping someone can direct me to the solution. Thanks.

#2

You seem to have shown us what is in the log when you run node-red-stop just as it is starting. What do you see when you run node-red-start?

#3

Thanks for clarifying…This cycles until I stop it.

Starting as a systemd service.
Started Node-RED graphical event wiring tool.
30 Jun 11:57:39 - [info]
Welcome to Node-RED

30 Jun 11:57:39 - [info] Node-RED version: v0.18.7
30 Jun 11:57:39 - [info] Node.js version: v8.11.3
30 Jun 11:57:39 - [info] Linux 4.14.50-v7+ arm LE
30 Jun 11:57:40 - [info] Loading palette nodes
global Settings { uib_globalSettings: { debug: false },
userDir: ‘/home/pi/.node-red’,
httpNodeRoot: ‘/’ }
30 Jun 11:57:46 - [info] Dashboard version 2.9.4 started at /ui
30 Jun 11:57:47 - [warn] ------------------------------------------------------
30 Jun 11:57:47 - [warn] [node-red-contrib-moment2/moment] ‘moment’ already registered by module node-red-contrib-moment
30 Jun 11:57:47 - [warn] ------------------------------------------------------
30 Jun 11:57:47 - [info] Settings file : /home/pi/.node-red/settings.js
30 Jun 11:57:47 - [info] User directory : /home/pi/.node-red
30 Jun 11:57:47 - [warn] Projects disabled : editorTheme.projects.enabled=false
30 Jun 11:57:47 - [info] Flows file : /home/pi/.node-red/flows_raspberrypi3.json
30 Jun 11:57:47 - [info] Server now running at http://127.0.0.1:1880/
30 Jun 11:57:47 - [warn]

Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the ‘credentialSecret’ option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.

30 Jun 11:57:47 - [warn] Error loading credentials: SyntaxError: Unexpected token � in JSON at position 0
30 Jun 11:57:47 - [warn] Error loading flows: Error: Failed to decrypt credentials
30 Jun 11:57:47 - [info] Starting flows
30 Jun 11:57:48 - [info] Started flows
30 Jun 11:57:48 - [info] [sonoff-server:2f8463fd.c923ec] SONOFF Server Started On Port 1080
30 Jun 11:57:48 - [red] Uncaught Exception:
30 Jun 11:57:48 - Error: listen EACCES 0.0.0.0:443
at Object._errnoException (util.js:992:11)
at _exceptionWithHostPort (util.js:1014:20)
at Server.setupListenHandle [as _listen2] (net.js:1338:19)
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Unit entered failed state.
nodered.service: Failed with result ‘exit-code’.
nodered.service: Service hold-off time over, scheduling restart.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.
30 Jun 11:57:50 - [info]

#4

There is a problem decrypting your credentials file (which contains any node red user/passwords you may have entered. The easiest way to recover from this is to delete the file .node-red/flows_<something>_cred.json where will probably be the name of the computer. Then restart node-red. You will have to re-enter any credentials that you might have saved.

#5

I deleted the _cred.json file and restarted node-red.

This is the currently cycling fail on start…the _cred.json file did not regenerate, nor did it ask for any credentials. I also went into the settings file and uncommented the user/pw login bits. But that by its self didn’t solve anything.

Any other suggestions?

Starting as a systemd service.
Started Node-RED graphical event wiring tool.
30 Jun 12:46:56 - [info]
Welcome to Node-RED

30 Jun 12:46:56 - [info] Node-RED version: v0.18.7
30 Jun 12:46:56 - [info] Node.js version: v8.11.3
30 Jun 12:46:56 - [info] Linux 4.14.50-v7+ arm LE
30 Jun 12:46:57 - [info] Loading palette nodes
global Settings { uib_globalSettings: { debug: false },
userDir: ‘/home/pi/.node-red’,
httpNodeRoot: ‘/’ }
30 Jun 12:47:03 - [info] Dashboard version 2.9.4 started at /ui
30 Jun 12:47:04 - [warn] ------------------------------------------------------
30 Jun 12:47:04 - [warn] [node-red-contrib-moment2/moment] ‘moment’ already registered by module node-red-contrib-moment
30 Jun 12:47:04 - [warn] ------------------------------------------------------
30 Jun 12:47:04 - [info] Settings file : /home/pi/.node-red/settings.js
30 Jun 12:47:04 - [info] User directory : /home/pi/.node-red
30 Jun 12:47:04 - [warn] Projects disabled : editorTheme.projects.enabled=false
30 Jun 12:47:04 - [info] Flows file : /home/pi/.node-red/flows_raspberrypi3.json
30 Jun 12:47:04 - [info] Server now running at http://127.0.0.1:1880/
30 Jun 12:47:04 - [warn]

Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the ‘credentialSecret’ option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.

30 Jun 12:47:04 - [info] Starting flows
30 Jun 12:47:04 - [info] Started flows
30 Jun 12:47:04 - [info] [sonoff-server:2f8463fd.c923ec] SONOFF Server Started On Port 1080
30 Jun 12:47:04 - [red] Uncaught Exception:
30 Jun 12:47:04 - Error: listen EACCES 0.0.0.0:443
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Unit entered failed state.
nodered.service: Failed with result ‘exit-code’.
nodered.service: Service hold-off time over, scheduling restart.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.
30 Jun 12:47:07 - [info]
Welcome to Node-RED

30 Jun 12:47:07 - [info] Node-RED version: v0.18.7
30 Jun 12:47:07 - [info] Node.js version: v8.11.3
30 Jun 12:47:07 - [info] Linux 4.14.50-v7+ arm LE
30 Jun 12:47:08 - [info] Loading palette nodes
global Settings { uib_globalSettings: { debug: false },
userDir: ‘/home/pi/.node-red’,
httpNodeRoot: ‘/’ }
30 Jun 12:47:14 - [info] Dashboard version 2.9.4 started at /ui
30 Jun 12:47:15 - [warn] ------------------------------------------------------
30 Jun 12:47:15 - [warn] [node-red-contrib-moment2/moment] ‘moment’ already registered by module node-red-contrib-moment
30 Jun 12:47:15 - [warn] ------------------------------------------------------
30 Jun 12:47:15 - [info] Settings file : /home/pi/.node-red/settings.js
30 Jun 12:47:15 - [info] User directory : /home/pi/.node-red
30 Jun 12:47:15 - [warn] Projects disabled : editorTheme.projects.enabled=false
30 Jun 12:47:15 - [info] Flows file : /home/pi/.node-red/flows_raspberrypi3.json
30 Jun 12:47:15 - [info] Server now running at http://127.0.0.1:1880/
30 Jun 12:47:15 - [warn]

Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the ‘credentialSecret’ option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.

30 Jun 12:47:15 - [info] Starting flows
30 Jun 12:47:15 - [info] Started flows
30 Jun 12:47:15 - [info] [sonoff-server:2f8463fd.c923ec] SONOFF Server Started On Port 1080
30 Jun 12:47:15 - [red] Uncaught Exception:
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Unit entered failed state.
nodered.service: Failed with result ‘exit-code’.
nodered.service: Service hold-off time over, scheduling restart.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.
30 Jun 12:47:18 - [info]
Welcome to Node-RED

30 Jun 12:47:18 - [info] Node-RED version: v0.18.7
30 Jun 12:47:18 - [info] Node.js version: v8.11.3
30 Jun 12:47:18 - [info] Linux 4.14.50-v7+ arm LE
30 Jun 12:47:19 - [info] Loading palette nodes
Stopping Node-RED graphical event wiring tool…
Stopped Node-RED graphical event wiring tool.

#6

It looks to my inexperienced eye that the sonoff server is failing to watch/listen to something.

#7

To my limited experience… When I see a cyclic failure, the first thing I think of is power supply.

#8

hmmmm…

It’s plugged into the 120v wall outlet with the provided power supply. The pi runs well aside from node-red.

But it’s certainly plausible.

#9

I had many problems due to power supply or even the cable too thin too as SteveMann told, from other side I had also several issues using GPIOs even damaged some pi, at the end decided the better was to use PI for soft and use ESPs or arduino for managing out/in this also reduce power supply consumption and a lot of problems.

For me was the best choice with less than 10$ you can have an arduino mega with a lot of analog channels almost 50 digital ones… and just use it plugged via USB (with independent power supply of course), This has removed a lot of pains from me.

Regards

#10

What happens if you stop the sevice from trying to run. node-red-stop then run it manually with a blank flow. node-red blank.json does it start OK ?

#11

That is not a PSU issue. The server is trying to listen on port 443 and does not have permission to do so. Port 443 is the https port I believe. Are you trying to use https?

#12

I have to confess to just bailing and reinstalling from scratch. Seemed like the most efficient option considering how easy it would be to get back learning compared to banging my head on this problem that wouldn't matter when I used the Sonoff anyway.

Thanks for the help and suggestions.