node-red / node-red-docker

Repository for all things Node-RED and Docker related
Apache License 2.0
469 stars 382 forks source link

Crashing on RPi3 armv7l after latest build #395

Closed thalesmaoa closed 7 months ago

thalesmaoa commented 7 months ago

What are the steps to reproduce?

Run latest image on a 32bit buster Raspberry Pi 3 armv7l.

What happens?

nodered-casa  | 18 Nov 22:35:16 - [info] 
nodered-casa  | 
nodered-casa  | Welcome to Node-RED
nodered-casa  | ===================
nodered-casa  | 
nodered-casa  | 18 Nov 22:35:16 - [info] Node-RED version: v3.1.0
nodered-casa  | 18 Nov 22:35:16 - [info] Node.js  version: v16.20.2
nodered-casa  | 18 Nov 22:35:16 - [info] Linux 5.10.103-v7+ arm LE
nodered-casa  | 18 Nov 22:35:18 - [info] Loading palette nodes
nodered-casa  | 
nodered-casa  | 
nodered-casa  | #
nodered-casa  | # Fatal error in , line 0
nodered-casa  | # unreachable code
nodered-casa  | #
nodered-casa  | #
nodered-casa  | #
nodered-casa  | #FailureMessage Object: 0x7555075c
nodered-casa  | ./entrypoint.sh: line 14:     7 Trace/breakpoint trap   (core dumped) /usr/local/bin/node $NODE_OPTIONS node_modules/node-red/red.js --userDir /data $FLOWS "${@}"
nodered-casa exited with code 133

Please tell us about your environment:

$ cat /etc/os-release 
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
$ uname -a
Linux rasp 5.10.103-v7+ #1529 SMP Tue Mar 8 12:21:37 GMT 2022 armv7l GNU/Linux

The problem seems to emerged from the latest image (22 days ago). I wasn`t able to identify the before lastest to test. With some guidance, I can test.

Extra

If I add env variable, it crashes as well:

services:
  nodered-casa:
    image: nodered/node-red:latest
    container_name: nodered-casa
    restart: no
    #group_add: 
    #  - dialout
    #devices:
    #  - "/dev/ttyAMA0:/dev/ttyAMA0"
    ports:
      - '1881:1880'
    volumes:
      - ./data:/data
    environment:
      - TZ=America/Sao_Paulo
      - NODE_OPTIONS="--max_old_space_size=256"
    logging:
      options:
        max-size: "100m"
nodered-casa  | node:internal/modules/cjs/loader:1031
nodered-casa  |   throw err;
nodered-casa  |   ^
nodered-casa  | 
nodered-casa  | Error: Cannot find module '/usr/src/node-red/"--max_old_space_size=256"'
nodered-casa  |     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1028:15)
nodered-casa  |     at Function.Module._load (node:internal/modules/cjs/loader:873:27)
nodered-casa  |     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
nodered-casa  |     at node:internal/main/run_main_module:22:47 {
nodered-casa  |   code: 'MODULE_NOT_FOUND',
nodered-casa  |   requireStack: []
nodered-casa  | }
nodered-casa exited with code 1
Paraphraser commented 7 months ago

You could try either of the following

image: nodered/node-red:3.0.2
image: nodered/node-red:2.2

See also DockerHub - you need to go to the second page to find older images.

thalesmaoa commented 7 months ago

Thx @Paraphraser

I confirm that it does work for older version:

services:
  nodered-casa:
    #image: nodered/node-red:latest
    image: nodered/node-red:3.0.2
    container_name: nodered-casa
    restart: no
    ports:
      - '1881:1880'
    volumes:
      - ./data:/data
    environment:
      - TZ=America/Sao_Paulo
      - NODE_OPTIONS=--max_old_space_size=256
    logging:
      options:
        max-size: "100m"
        max-file: "3"
Paraphraser commented 7 months ago

And I can confirm that latest works on a Raspberry Pi 4B running Bullseye 64-bit.

I don't have a 3B so I can't test that hardware.

Although we'll have to wait for confirmation from the good folks who maintain this repo, I suspect your problem might turn out to be a Buster dependency. You might want to give some thought to upgrading to Bullseye or Bookworm.

hardillb commented 7 months ago

As the first error is getting thrown while trying to load Node-RED nodes can you include the package.json from your mounted /data directory so we can see what nodes you have installed.

Also have you installed any new nodes or upgraded a node recently?

hardillb commented 7 months ago

Also given the latest tag tracks Node-RED releases are you sure you had run this setup on Node-RED 3.1.0 before, especially as it runs with the 3.0.2 tag? When was the last time you pulled the container/

hardillb commented 7 months ago

As for the separate problem with setting an environment variable, I can't reproduce that locally wit the latest container and it shouldn't be possible looking at the entrypoint.sh script as the order of the script and the NODE_OPTIONS env var are the wrong way round.

https://github.com/node-red/node-red-docker/blob/c071039e204a945f008b8af35d12a49896da3d02/docker-custom/scripts/entrypoint.sh#L10

hardillb commented 7 months ago

Also read https://github.com/node-red/node-red-docker/issues/319

thalesmaoa commented 7 months ago

Hi @hardillb , you gave me a lot of contributions. I really appreciate it. You are correct. This is the only RPi running buster, others are all running bullseye. Your answer hit bullseye :laughing:.

Thx a lot!

I will upgrade, but the last post solve it for a while.