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

node-red-node-pi-gpio: python script nrgpio consuming a lot of processor time

Open
#1,090 0 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

On an original PI Zero, running NR 4.0 on Bullseye, with Python 3 I find that for each gpio pin configured there is an instance of the nrgpio script running. Each one of those consumes about 3% of the processor, even when there is no IO activity. Even on a Pi 3 it is 0.7%.
Looking at the source of nrgpio I deduce that the python input function may be polling stdin which is not ideal if I am right. Perhaps there is no alternative.

I have not been able to try it on python 2 to see if this is worse with 3, as I don't have a pi running 2.

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 by reading the nrgpio Python script and reproduce the idle processor use on the reported Raspberry Pi setup. Investigate how its input handling waits for GPIO activity, then verify that configured pins remain responsive while idle processor consumption is reduced.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.