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

Node-RED loses connection with GPIOD after two “deploys” (frequent docker restart necessary) :( #166

Open
4 of 6 tasks
DIYtechie opened this issue Feb 9, 2020 · 17 comments

Comments

@DIYtechie
Copy link

DIYtechie commented Feb 9, 2020

What are the steps to reproduce?

Run node-red in the official docker container.

Verify that the gpiod nodes have connection to the gpiod (daemon). Skærmbillede 2020-02-09 kl  23 14 03
Check that gpio input node actually works (e.g. use a simple switch to connect pin 5 to ground and see "OK" changing to 1 or 0).

Skærmbillede 2020-02-10 kl  20 30 32

Move some nodes and click “Deploy”. Do it again.

Check that gpio input node still works (in my setup it stoppes working). The gpiod node still states "OK" which indicates the gpio daemon is running. Running ps aux confirms this.
Skærmbillede 2020-02-10 kl  19 00 17

HOWEVER -connecting a pin to ground no longer makes the node change state.

restart the docker container - now it works again, but only until you click deploy 2 times again. Then a docker restart is needed again :(

Please tell us about your environment:

Hardware: Raspberry Pi 3B+.

  • Node-RED version: 1.0.3
  • Node.js version: latest?
  • npm version: latest?
  • Platform/OS: latest docker image.
    host os: latest Raspian Buster
  • Browser: google chrome (not a browser issue).
  • pigiod is latest version:
    Skærmbillede 2020-02-09 kl  23 38 54
@DIYtechie DIYtechie changed the title GPIOD issues - loses connection with GPIO Node-RED loses connection with GPIOD (frequent docker restart necessary) :( Feb 10, 2020
@DIYtechie
Copy link
Author

This issue remains, and more testing confirms that Node-RED loses connection to GPIOD after the second "Deploy".

Frustrating issue these days where I create a lot of new flows and therefore have to restart the container several times a day.

@DIYtechie DIYtechie changed the title Node-RED loses connection with GPIOD (frequent docker restart necessary) :( Node-RED loses connection with GPIOD after two “deploys” (frequent docker restart necessary) :( Aug 14, 2020
@DIYtechie
Copy link
Author

Amy news on this issue? Still a PITA having to restart Node-RED container everytime I make a few changes in Node-RED.

@Ekristoffe
Copy link

Hello, is it possible to enable the trace mode of the node-red logging and see what happening in the logs ?
More informations on the setting file:
https://nodered.org/docs/user-guide/runtime/settings-file
and about some parameters:
https://nodered.org/docs/user-guide/runtime/configuration
Also have you been able to check if this error is only happening in the docker version and not the standalone version directly on raspbian ?

@Paraphraser
Copy link

Try this (my example uses vi but you can use the text editor of your choice):

$ cd ~/IOTstack
$ vi volumes/nodered/data/settings.js

Find this chunk of text:

logging: {
        // Only console logging is currently supported
        console: {
            // Level of logging to be recorded. Options are:
            // fatal - only those errors which make the application unusable should be recorded
            // error - record errors which are deemed fatal for a particular request + fatal errors
            // warn - record problems which are non fatal + errors + fatal errors
            // info - record information about the general running of the application + warn + error + fatal errors
            // debug - record information which is more verbose than info + info + warn + error + fatal errors
            // trace - record very detailed logging + debug + info + warn + error + fatal errors
            // off - turn off all logging (doesn't affect metrics or audit)
            level: "info",
            // Whether or not to include metric events in the log output
            metrics: false,
            // Whether or not to include audit events in the log output
            audit: false
        }
    },

Change level from "info" to "trace", the other options to true if you thing those would be useful, and save the file. Then:

$ docker-compose restart nodered
$ docker logs -f nodered

The restart causes NodeRed to pay attention to the settings.js change.

The logs command is like a tail -f for watching any other kind of log.

Control-C to abort and I'm sure you can work out how to undo the change.

@DIYtechie
Copy link
Author

Thanks for your suggestions 🙏🏻 Will try them out as soon as possible. Probably in the weekend.

@DIYtechie
Copy link
Author

I tried the above and now have a huge logfile. What should I look for and what should I post here for you to be able to help debugging? As mentioned, everything works right after a docker restart nodered. The issue arises after the second deploy efter a restart.

@Ekristoffe
Copy link

how huge is the file ?
Could you put it as attachement (check before there is no credencial or confidential information inside)

@DIYtechie
Copy link
Author

how huge is the file ?
Could you put it as attachement (check before there is no credencial or confidential information inside)

It's a 93 MB pure text file, but I am worried that it contains confinendial information (searching for "PSK" returned more than 16,000 hits). What am I looking for? perhaps I can cut out the relevant sections?

@Ekristoffe
Copy link

As it I will say any error message.
Plus if you can try to split your file from the first boot and each reload and see what are the differences.

@RaymondMouthaan
Copy link
Contributor

Amy news on this issue? Still a PITA having to restart Node-RED container everytime I make a few changes in Node-RED.

I am not investigating this issue and it's not a best-way-solution, but you might want consider a second NR container which does the GPIO interaction and another (probably your existing container) which does the rest of all your flows.

pi gpio <-> node-red-gpio-container <-> mqtt <-> node-red-main-container

Using the concept of "Separation of concerns" and to avoid the connection loss after each "Deployment" of your flows.

@DIYtechie
Copy link
Author

Thanks for sharing this idea for a workaround. 👍🏻Hadn’t thought of that. I still would like this issue solved, but not sure how to get the relevant data from the log file.

@Nodi-Rubrum
Copy link

Is this being fixed at any point soon? Really frustrating when node just does not work as it should after a deploy.

@dceejay
Copy link
Member

dceejay commented Feb 15, 2021

by whom ? More than happy to accept help any assistance from someone who can re-create the problem and help identify the actual issue.

@DIYtechie
Copy link
Author

A workaround in some cases is to only deploy the changed nodes and not the whole flow or all flows. Now that I’m working on other flows this really saves me from a lot of frustration.

@dceejay
Copy link
Member

dceejay commented Feb 15, 2021

In the underlying library `node_modules/js-pigpio/index.js' I see the close method

pigpio.prototype.close = function() {
    "use strict";
    this.sl.s.end();
};

maybe try changing that to this.sl.s.destroy();
so it really closes the connection rather than half-closes it... feedback please

@shmosn
Copy link

shmosn commented Aug 15, 2024

In the underlying library `node_modules/js-pigpio/index.js' I see the close method

pigpio.prototype.close = function() {
    "use strict";
    this.sl.s.end();
};

maybe try changing that to this.sl.s.destroy(); so it really closes the connection rather than half-closes it... feedback please

Just came across the thread. Thanks for the idea; I tried it but it did not solve the issue.
Well, only deploying the changed nodes or restarting the container are confirmed workarounds for me so far.

cheers.

@rgillam100
Copy link

Hi, is there any progress on this issues?
I can confirm it happens with Raspberry Pi 4 running
PI OS 64bit Bookworm Release date: July 4th 2024
System: 64-bit
Node Red 4.0.3
I am not using containers.

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

8 participants