node-red / node-red/node-red-nodes

node-red-node-pi-gpio -> nrgpio.py uses ~1% CPU per IO port

Open
#1,060 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.1k
Forks
612
Avg merge
13h 57m
Merged PRs (30d)
3

Description

Node-red: 3.1.8
node-red-node-pi-gpio: 2.0.6
Nodejs: 20.12.1
Raspberry Pi 5 (64bit)

My flow uses multiple "rpi-gpio in" nodes to monitor if an IO port is 0 or 1. Debouncing is set to 100mS (changing this value seems not to solve the issue).
The issue is that htop shows 4 "nrgpio.py" process per IO line that is configured in the node-red flow. That are about 40 processes. 1 of each 4 processes continously has a CPU usage of about 0.7 up to 2%. So 10 processes use around 1% each on average.

I did not notice that issue on my Raspberry Pi 4 that ran a 32bit OS.

Is that something that can be fixed in this module?

Example:
[ { "id": "a95c2f4d.c0168", "type": "rpi-gpio in", "z": "bb3e7715.2c09", "name": "bad", "pin": "26", "intype": "down", "debounce": "100", "read": true, "bcm": true, "x": 90, "y": 700, "wires": [ [ "b860d764.0aea98", "a65e9d62ead68e73" ] ] }, { "id": "728b682e.a4b2c", "type": "rpi-gpio in", "z": "bb3e7715.2c09", "name": "wohn", "pin": "16", "intype": "down", "debounce": "100", "read": true, "bcm": true, "x": 90, "y": 640, "wires": [ [ "9b4d24c4.8bd2f", "a65e9d62ead68e73" ] ] }, { "id": "17b463b.93fcc1c", "type": "rpi-gpio in", "z": "bb3e7715.2c09", "name": "schlaf", "pin": "21", "intype": "down", "debounce": "100", "read": true, "bcm": true, "x": 90, "y": 520, "wires": [ [ "c8aba6f6.5eb048", "a65e9d62ead68e73" ] ] }, { "id": "a65e9d62ead68e73", "type": "debug", "z": "bb3e7715.2c09", "name": "debug 51", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 420, "y": 640, "wires": [] } ]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with nrgpio.py and reproduce the supplied flow on a Raspberry Pi 5 using the listed Node-RED, node-red-node-pi-gpio, and Node.js versions; inspect process count and CPU usage in htop. Done means the GPIO input configuration no longer shows the reported per-port CPU overhead, with behavior checked against the supplied flow and Raspberry Pi 4 comparison.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js, python, raspberry-pi
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.