Problem deploying flows on RasPi 4 project, help needed!

Hi for everyone!

First off all i´m new in this forum and also rookie with NR. I have done some projects with it but nothing special.

So at the moment i´m doing project which setup is:

HW: Raspberry Pi 4 Model B, 4GB RAM
- Raspbian Bullseye as operating system

SW: Node-red V4.0.2 and Node.JS V18.20.4

Node-red is running locally as a service, so it starts always when RasPi boots up. All software installing are done as Node-red recommends on their site for RasPi.

And here is the NR project presented with pictures (JSON-file available later in this message). Sorry about the Finnish language in code, as it is my native language:

*Edit: as new user i was able to post only two pictures in one time...


This point i should make clear that flows 5-11 ("PR2-PR8") are identical what comes to nodes. Only thing that changes between those flows is name of the global variables.

So, the problem that i have with my project: I developed this program in order from flow 1 to flow 4. Everything worked great and i was happy. Then i made i move and copied flow 4 "PR1" to flow 5 "PR2". Everything worked still great... I kept copying and made also flow 6 "PR3" similar with flows 4 and 5. Of course i changed the name of global variables in these copying situations to prevent overlapping of variables. After making the flow 6 i hit the deploy-button and it was a game changer. Deploy-button just stayed running grey and also dashboard UI went down from another tab. After few minutes the editor gave message: "deploy failed: no response from server". I was shocked and thought i did something wrong. But i restarted NR in safe-mode and finished my job by doing all flows ready to flow 11 "PR8". After that i made some error-testing and found out that my RasPi allows only two "PRX"-flows on same time. With two of those, all works and it doesn´t matter what are the numbers of those flows. But immediately when i´m adding three or more those "PRx"-flows, the deploy is not going trough any more and NR stops working...

I´ve tried debugging from NR log, doesnt give any hints whats wrong. Also made research from internet with similar problems but that what has fixed those doesn´t help in my situation. So guys, any thoughts what could cause this kind of acting? Memory of RasPi? Node.JS? I´m stuck because i cant find any more tools to fix this by my self.

Today i installed NR to my PC laptop (WIN10) and loaded my project in the editor. Deployment went trough and all flows worked as should. So this info limits the problem to RasPi?

Please, ask more information!

Here is the code in JSON:
Okay my code is too long for here, i can email the JSON for requesters.

Here is two more pictures that was meant to be in starting post..


Your first step should probably be to update to Node.js v20.
Use the Raspberry Pi installation script with --node20 added after the closing bracket.

You don't say if you are accessing Node-red from a browser on the Pi or from your PC.
I find that Node-red runs very well with on a Pi 4, coping with dozens of flows.
I only access it from my PC and ssh though.

Running htop in an ssh terminal while you deploy might indicate if your CPU or memory are the cause of the hangup.

Are you using a micro SD card or an SSD?

It's generally a bad idea for an application to have multiple copies of the same code.
Node-red has various ways to eliminate this, including subflows and link calls.
It's probably a mistake to depend on global variables too.

agree with that ,and maybe flow-scoped context property should be used.

Hey guys!

Sorry about long delay for answering, i was having a holiday in a wilderness hiking and wasn't able to make any fixing moves to my project.

But now i´m back and thank you so much for ideas. Firstly i updated my node.js to version 20.16.0.

I´m accessing to NR WEB-editor only with my PC via local ethernet and with RasPi connection i`m using SSH. In RasPi i have 16GB MicroSDHC card as boot media.

I also checked htop (after node.js was updated) and there were nothing alerting when deploying...

I also modified my "PRx" flows to use the main function as subflow, also changed all global variables to flow-variables. Any of these changes above didn't help to fix my problem, it still occurs as before.

Any new ideas to test?

When it is locked up, stop node red and start it again and post the startup log please.

!IMPORTANT UPDATE!

I found something very interesting: I deleted all the GPIO nodes from all flows that i was using in my project. Then i hit deploy and all worked fine! So the problem is not in the global variables or using the same function as copy many times, i think the problem is with the RPi GPIO interfaces....

So i'm using BME280-sensor trough I2C and totally 9 DI's and 8 DO's via RasPi GPIO interface.

You can see those in picture below, there is 1 DI and 1 DO in every "PRx"-flow. In this picture you can see the BME280-sensor is working properly, it shows measured data under it. Also everything else works fine, in this situation there is used I2C-can and 2 DI's and 1 DO's from RasPi GPIO interface totally.

The problems that i explained in the starting post, starts when i'm adding the rest DI's and DO's to other "PRx"-flows. Actually it stops working right after i've used I2C-can and 5 DI's and 4 DO's totally! Please look at the picture below, that is taken when the problem is on, you can see that BME280-sensor stays in init mode and nothing works...

I'm using this node-set: node-red-gpiox (node) - Node-RED (nodered.org) for controlling the GPIO interface.

Earlier in this project i used this: node-red-node-pi-gpio (node) - Node-RED (nodered.org) but it didn't work properly. It started to act weird when deploying many times...

I hope this update shows the way to find the fix for this problem!

Which sounds like a very similar problem to the one you are encountering with node-red-gpiox.

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