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

SenseHat ERROR shutsdown the system

Open
#937 1 comment 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

SenseHat 013 kills the whole system.

Initially SenseHat connects but within a couple of minutes not only does SenseHat disconnect but kills the Node-RED system.
the node-red has to be restarted has to be restarted.

30 Jul 20:56:29 - [error] TypeError: Cannot read properties of null (reading 'kill')
at Socket. (/home/keefer/.node-red/node_modules/node-red-node-pi-sense-hat/sensehat.js:110:21)
at Socket.emit (node:events:527:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Socket.Readable.push (node:internal/streams/readable:228:10)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
keefer@rpi4:~ $

       });
        hat.stderr.on('data', function (data) {
            **// Any data on stderr means a bad thing has happened.**
            **// Best to kill it and let it reconnect.**
            if (RED.settings.verbose) { RED.log.error("err: "+data+" :"); }
            hat.kill('SIGKILL');
        });

?? python2.7 - I thought it was dead?

10 if (!fs.existsSync('/usr/lib/python2.7/dist-packages/sense_hat') && !fs.existsSync('/usr/lib/python3/dist-packages/sense_hat')) {
throw "Error: Can't find Sense HAT python libraries. Run sudo apt-get install sense-hat";

sudo apt-get install sense-hat didn't work. I ended up using pip.

Please tell us about your environment:
  • Node-RED version: 301
  • node.js version: v16.16.0
  • npm version:8.15.1
  • Platform/OS: Debian 11
  • Browser: firefox, chrom

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 in sensehat.js at the stderr handler around line 110 and review how the Sense HAT process is created and disconnected. Reproduce the failure in the reported Node-RED, Node.js, and Debian environment, then verify that an stderr event does not terminate Node-RED when the process handle is null and that reconnection still works.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.