hassio-addons/addon-node-red

PANIC: unprotected error in call to Lua API (bad light userdata pointer) #816

sihawken posted onGitHub

Problem/Motivation

Cannot connect to Node-Red via http://192.168.1.x:1880/ nor via Home Assistant. Other addons confirmed working.

Expected behavior

To be able to connect to Node-Red.

Actual behavior

image

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Add-on: Node-RED
 Flow-based programming for the Internet of Things
-----------------------------------------------------------
 Add-on version: 7.2.11
 You are running the latest version of this add-on.
 System: Ubuntu 20.04.1 LTS  (aarch64 / raspberrypi4-64)
 Home Assistant Core: 2020.12.1
 Home Assistant Supervisor: 2020.12.7
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] nginx.sh: executing... 
[cont-init.d] nginx.sh: exited 0.
[cont-init.d] node-red.sh: executing... 
patching file nodes/ui_base.html
Hunk #1 succeeded at 1156 (offset 625 lines).
up to date in 0.662s
found 0 vulnerabilities
[cont-init.d] node-red.sh: exited 0.
[cont-init.d] user.sh: executing... 
[cont-init.d] user.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[00:39:27] INFO: Starting Node-RED...
> addon-node-red@ start /opt
> node $NODE_OPTIONS node_modules/node-red/red.js "--settings" "/etc/node-red/config.js"
18 Dec 00:39:30 - [info] 
Welcome to Node-RED
===================
18 Dec 00:39:30 - [info] Node-RED version: v1.2.5
18 Dec 00:39:30 - [info] Node.js  version: v12.18.4
18 Dec 00:39:30 - [info] Linux 5.4.0-1025-raspi arm64 LE
18 Dec 00:39:31 - [info] Loading palette nodes
18 Dec 00:39:34 - [warn] [RED.events] Deprecated use of "nodes-started" event from "/opt/node_modules/node-red-contrib-actionflows/actionflows/actionflows.js:615:14". Use "flows:started" instead.
18 Dec 00:39:36 - [info] Dashboard version 2.24.0 started at /endpoint/ui
/bin/sh: /opt/node_modules/node-red-node-pi-gpio/testgpio.py: not found
18 Dec 00:39:37 - [warn] rpi-gpio : Raspberry Pi specific node set inactive
18 Dec 00:39:37 - [info] Settings file  : /etc/node-red/config.js
18 Dec 00:39:37 - [info] Context store  : 'default' [module=memory]
18 Dec 00:39:37 - [info] User directory : /config/node-red/
18 Dec 00:39:37 - [warn] Projects disabled : editorTheme.projects.enabled=false
18 Dec 00:39:37 - [info] Flows file     : /config/node-red/flows.json
18 Dec 00:39:38 - [info] Starting flows
18 Dec 00:39:38 - [info] Started flows
18 Dec 00:39:38 - [info] Server now running at http://127.0.0.1:46836/
[00:39:38] INFO: Starting NGinx...
nginx: [alert] detected a LuaJIT version which is not OpenResty's; many optimizations will be disabled and performance will be compromised (see https://github.com/openresty/luajit2 for OpenResty's LuaJIT or, even better, consider using the OpenResty releases from https://openresty.org/en/download.html)
18 Dec 00:39:43 - [info] [server:Home Assistant] Connecting to http://supervisor/core
18 Dec 00:39:43 - [info] [server:Home Assistant] Connected to http://supervisor/core
PANIC: unprotected error in call to Lua API (bad light userdata pointer)
PANIC: unprotected error in call to Lua API (bad light userdata pointer)
PANIC: unprotected error in call to Lua API (bad light userdata pointer)
PANIC: unprotected error in call to Lua API (bad light userdata pointer)
PANIC: unprotected error in call to Lua API (bad light userdata pointer)
PANIC: unprotected error in call to Lua API (bad light userdata pointer)
PANIC: unprotected error in call to Lua API (bad light userdata pointer)
PANIC: unprotected error in call to Lua API (bad light userdata pointer)
PANIC: unprotected error in call to Lua API (bad light userdata pointer)
PANIC: unprotected error in call to Lua API (bad light userdata pointer)
PANIC: unprotected error in call to Lua API (bad light userdata pointer)
PANIC: unprotected error in call to Lua API (bad light userdata pointer)
PANIC: unprotected error in call to Lua API (bad light userdata pointer)
PANIC: unprotected error in call to Lua API (bad light userdata pointer)
PANIC: unprotected error in call to Lua API (bad light userdata pointer)
PANIC: unprotected error in call to Lua API (bad light userdata pointer)
PANIC: unprotected error in call to Lua API (bad light userdata pointer)

Steps to reproduce

Boot up a Raspberry Pi 4 (64 bit OS), install Home Assistant w/ Supervisor, install Node-Red addon.

Proposed changes

As mentioned in this 2019 ticket, this appears to be a docker base image issue. Perhaps updating to a new base image reintroduced this bug.

https://github.com/hassio-addons/addon-node-red/issues/199


Ubuntu 20.04.1 LTS is not a supported system

posted by frenck over 4 years ago

For anyone who comes across this issue, I believe I found out why this affects certain 64 bit hosts and not others. Pardon me if I get some details wrong, this is all new to me.

This actually seems to be a common issue with Ubuntu 20.04 LTS and LuaJIT. https://github.com/LuaJIT/LuaJIT/pull/230#issuecomment-260205661

Essentially, any kernel that exceeds 47bit virtual memory addresses, will encounter this issue. This affects docker images, since the kernel is shared with them. This is a bug that won't be fixed, as far as I can tell. And software packages that wish to support ARM64 are just strongly encouraged to not use the light userdata type.

Clearly, somewhere in this chain, the light userdata type is being used when it probably shouldn't be.

This means that somewhere in the chain: nginx-mod-http-lua, lua-resty-http, home assistant/addon lua code is not arm64 compatible.

Ubuntu 20.04 uses 48bit virtual memory addresses, which is where the incompatibility lies. Luckily, ARM64 also supports 39bit virtual memory addresses.

https://www.kernel.org/doc/html/latest/arm64/memory.html

I am attempting recompile the kernel with 39bit virtual memory address space instead.

Following these instructions, the ubuntu kernel can be recompiled : https://askubuntu.com/questions/1238261/customizing-the-kernel-arm64-using-ubuntu-20-04-lts-on-a-raspberry-pi-4

In config.common.ubuntu, I set:

CONFIG_ARM64_VA_BITS=39
CONFIG_ARM64_VA_BITS_39=y

And in arm64/config.common.arm64 I set:

CONFIG_PGTABLE_LEVELS=3

I will follow-up and edit this if I'm successful in getting this running.

posted by sihawken over 4 years ago

@frenck It seems to be a bigger problem. The same happens for me with the Home Assistant Blue https://www.home-assistant.io/blue

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Add-on: Node-RED
 Flow-based programming for the Internet of Things
-----------------------------------------------------------
 Add-on version: 7.2.11
 You are running the latest version of this add-on.
 System: Home Assistant OS 5.8  (aarch64 / odroid-n2)
 Home Assistant Core: 2020.12.1
 Home Assistant Supervisor: 2020.12.7
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] nginx.sh: executing... 
[cont-init.d] nginx.sh: exited 0.
[cont-init.d] node-red.sh: executing... 
patching file nodes/ui_base.html
Hunk #1 succeeded at 1156 (offset 625 lines).
up to date in 1.294s
found 0 vulnerabilities
[cont-init.d] node-red.sh: exited 0.
[cont-init.d] user.sh: executing... 
[cont-init.d] user.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[23:16:39] INFO: Starting Node-RED...
> addon-node-red@ start /opt
> node $NODE_OPTIONS node_modules/node-red/red.js "--settings" "/etc/node-red/config.js"
20 Dec 23:16:41 - [info] 
Welcome to Node-RED
===================
20 Dec 23:16:41 - [info] Node-RED version: v1.2.5
20 Dec 23:16:41 - [info] Node.js  version: v12.18.4
20 Dec 23:16:41 - [info] Linux 5.9.14 arm64 LE
20 Dec 23:16:42 - [info] Loading palette nodes
20 Dec 23:16:44 - [warn] [RED.events] Deprecated use of "nodes-started" event from "/opt/node_modules/node-red-contrib-actionflows/actionflows/actionflows.js:615:14". Use "flows:started" instead.
20 Dec 23:16:45 - [info] Dashboard version 2.24.0 started at /endpoint/ui
/bin/sh: /opt/node_modules/node-red-node-pi-gpio/testgpio.py: not found
20 Dec 23:16:45 - [warn] rpi-gpio : Raspberry Pi specific node set inactive
20 Dec 23:16:46 - [info] Settings file  : /etc/node-red/config.js
20 Dec 23:16:46 - [info] Context store  : 'default' [module=memory]
20 Dec 23:16:46 - [info] User directory : /config/node-red/
20 Dec 23:16:46 - [warn] Projects disabled : editorTheme.projects.enabled=false
20 Dec 23:16:46 - [info] Flows file     : /config/node-red/flows.json
20 Dec 23:16:46 - [info] Starting flows
20 Dec 23:16:46 - [info] Started flows
20 Dec 23:16:46 - [info] Server now running at http://127.0.0.1:46836/
[23:16:46] INFO: Starting NGinx...
nginx: [alert] detected a LuaJIT version which is not OpenResty's; many optimizations will be disabled and performance will be compromised (see https://github.com/openresty/luajit2 for OpenResty's LuaJIT or, even better, consider using the OpenResty releases from https://openresty.org/en/download.html)
20 Dec 23:16:51 - [info] [server:Home Assistant] Connecting to http://supervisor/core
20 Dec 23:16:51 - [info] [server:Home Assistant] Connected to http://supervisor/core
PANIC: unprotected error in call to Lua API (bad light userdata pointer)
PANIC: unprotected error in call to Lua API (bad light userdata pointer)
PANIC: unprotected error in call to Lua API (bad light userdata pointer)
PANIC: unprotected error in call to Lua API (bad light userdata pointer)
PANIC: unprotected error in call to Lua API (bad light userdata pointer)
PANIC: unprotected error in call to Lua API (bad light userdata pointer)
posted by DunklerPhoenix over 4 years ago

Fund this Issue

$0.00
Funded

Pull requests