节点红色内存不足问题
Node-red Out of Memory issue
我使用此文档 (Node-red doc for RPI) 进行 node-red 安装。安装工作正常。但是在开始 node-red-start
或 node-red-pi
之后,我看到下一个日志有错误。我不是 nodejs 专家。日志中是 npm 和 nodejs 版本。
Mar 22:48:23 - [info]
Welcome to Node-RED
===================
4 Mar 22:48:23 - [info] Node-RED version: v0.19.6
4 Mar 22:48:23 - [info] Node.js version: v10.15.2
4 Mar 22:48:23 - [info] Linux 4.9.35-v7+ arm LE
4 Mar 22:48:25 - [info] Loading palette nodes
4 Mar 22:48:30 - [info] Worldmap version 1.5.29
4 Mar 22:48:31 - [info] Dashboard version 2.14.0 started at /ui
4 Mar 22:48:35 - [warn] ------------------------------------------------------
4 Mar 22:48:35 - [warn] [node-red-contrib-generic-ble/generic-ble] Error: Cannot find module 'bluetooth-hci-socket'
4 Mar 22:48:35 - [warn] ------------------------------------------------------
4 Mar 22:48:35 - [info] Settings file : /home/pi/.node-red/settings.js
4 Mar 22:48:35 - [info] Context store : 'default' [module=memory]
4 Mar 22:48:35 - [info] User directory : /home/pi/.node-red
4 Mar 22:48:35 - [warn] Projects disabled : editorTheme.projects.enabled=false
4 Mar 22:48:35 - [info] Flows file : /home/pi/.node-red/flows_server.json
4 Mar 22:48:35 - [info] Server now running at https://127.0.0.1:1880/
4 Mar 22:48:35 - [warn]
---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------
4 Mar 22:48:35 - [info] Starting flows
4 Mar 22:48:37 - [info] [worldmap:1ac45205.ff98ee] started at /worldmap
4 Mar 22:48:37 - [info] [worldmap:ac8fa4a4.314918] started at /worldmap
4 Mar 22:48:38 - [info] [worldmap:20c6db58.a44e34] started at /worldmap
4 Mar 22:48:38 - [info] [worldmap:bf26442c.e7f3b8] started at /worldmap
4 Mar 22:48:38 - [info] [worldmap:ee74d5bc.e8f268] started at /worldmap
4 Mar 22:48:38 - [info] Started flows
4 Mar 22:48:38 - [info] [mqtt-broker:mqtt] Connected to broker: mqtt://localhost:1883
<--- Last few GCs --->
[24581:0x34f1a28] 138171 ms: Mark-sweep 702.7 (729.7) -> 702.7 (733.2) MB, 9657.7 / 0.1 ms (average mu = 0.092, current mu = 0.004) allocation failure scavenge might not succeed
[24581:0x34f1a28] 148339 ms: Mark-sweep 706.3 (733.2) -> 706.3 (733.2) MB, 9979.6 / 0.1 ms (average mu = 0.055, current mu = 0.019) allocation failure scavenge might not succeed
<--- JS stacktrace --->
Cannot get stack trace in GC.
FATAL ERROR: MarkCompactCollector: semi-space copy, fallback in old gen Allocation failed - JavaScript heap out of memory
现在我有更多可用信息,堆栈跟踪...
==== JS stack trace =========================================
0: ExitFrame [pc: 0x37deae9c]
1: StubFrame [pc: 0x37dec080]
Security context: 0x4b492701 <JSObject>
2: encode(aka encode) [0x4fdd867d] [/home/pi/.node-red/node_modules/qs/lib/utils.js:~118] [pc=0x20067594](this=0x36c8438d <undefined>,str=0x43a423d1 <Very long string[17508]>)
3: arguments adaptor frame: 2->1
4: stringify(aka stringify) [0x4fdd737d] [/home/pi/.node-red/node_modules/qs/lib/stringify.js:61] [bytecode=0x289...
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
这意味着我的节点中有错误的节点?如果是,我如何找到哪个节点有错误?
错误的重要部分是:
fallback in old gen Allocation failed - JavaScript heap out of memory
这意味着 Node-RED 运行正在运行的 NodeJS 虚拟机 运行 内存不足。
如果不正确理解您的流程正在做什么,就不可能说出为什么会发生这种情况,但一个合理的猜测是您正在尝试处理(来自某处)传入消息的速度比它们到达时慢,或者可能是您将内容存储在 Context 中并且从不删除它们,因此它们会随着时间的推移而累积。
编辑:
OOM 的堆栈跟踪不一定有帮助,这正是在没有更多空间时尝试分配的内容。不代表就是原因。
如前所述,调试此问题的唯一方法是详细了解您的流程正在做什么(Stack Overflow 可能不是解决此问题的最佳场所。您可能在 Node-RED 上做得更好论坛或 slack,在那里您可能会找到可以与您一起解决问题的人)
问题出在错误的电报节点配置上。这在 qs/lib/utils.js:~118
中调用了 self 字符串更大,直到堆 space...
感谢
我使用此文档 (Node-red doc for RPI) 进行 node-red 安装。安装工作正常。但是在开始 node-red-start
或 node-red-pi
之后,我看到下一个日志有错误。我不是 nodejs 专家。日志中是 npm 和 nodejs 版本。
Mar 22:48:23 - [info]
Welcome to Node-RED
===================
4 Mar 22:48:23 - [info] Node-RED version: v0.19.6
4 Mar 22:48:23 - [info] Node.js version: v10.15.2
4 Mar 22:48:23 - [info] Linux 4.9.35-v7+ arm LE
4 Mar 22:48:25 - [info] Loading palette nodes
4 Mar 22:48:30 - [info] Worldmap version 1.5.29
4 Mar 22:48:31 - [info] Dashboard version 2.14.0 started at /ui
4 Mar 22:48:35 - [warn] ------------------------------------------------------
4 Mar 22:48:35 - [warn] [node-red-contrib-generic-ble/generic-ble] Error: Cannot find module 'bluetooth-hci-socket'
4 Mar 22:48:35 - [warn] ------------------------------------------------------
4 Mar 22:48:35 - [info] Settings file : /home/pi/.node-red/settings.js
4 Mar 22:48:35 - [info] Context store : 'default' [module=memory]
4 Mar 22:48:35 - [info] User directory : /home/pi/.node-red
4 Mar 22:48:35 - [warn] Projects disabled : editorTheme.projects.enabled=false
4 Mar 22:48:35 - [info] Flows file : /home/pi/.node-red/flows_server.json
4 Mar 22:48:35 - [info] Server now running at https://127.0.0.1:1880/
4 Mar 22:48:35 - [warn]
---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------
4 Mar 22:48:35 - [info] Starting flows
4 Mar 22:48:37 - [info] [worldmap:1ac45205.ff98ee] started at /worldmap
4 Mar 22:48:37 - [info] [worldmap:ac8fa4a4.314918] started at /worldmap
4 Mar 22:48:38 - [info] [worldmap:20c6db58.a44e34] started at /worldmap
4 Mar 22:48:38 - [info] [worldmap:bf26442c.e7f3b8] started at /worldmap
4 Mar 22:48:38 - [info] [worldmap:ee74d5bc.e8f268] started at /worldmap
4 Mar 22:48:38 - [info] Started flows
4 Mar 22:48:38 - [info] [mqtt-broker:mqtt] Connected to broker: mqtt://localhost:1883
<--- Last few GCs --->
[24581:0x34f1a28] 138171 ms: Mark-sweep 702.7 (729.7) -> 702.7 (733.2) MB, 9657.7 / 0.1 ms (average mu = 0.092, current mu = 0.004) allocation failure scavenge might not succeed
[24581:0x34f1a28] 148339 ms: Mark-sweep 706.3 (733.2) -> 706.3 (733.2) MB, 9979.6 / 0.1 ms (average mu = 0.055, current mu = 0.019) allocation failure scavenge might not succeed
<--- JS stacktrace --->
Cannot get stack trace in GC.
FATAL ERROR: MarkCompactCollector: semi-space copy, fallback in old gen Allocation failed - JavaScript heap out of memory
现在我有更多可用信息,堆栈跟踪...
==== JS stack trace =========================================
0: ExitFrame [pc: 0x37deae9c]
1: StubFrame [pc: 0x37dec080]
Security context: 0x4b492701 <JSObject>
2: encode(aka encode) [0x4fdd867d] [/home/pi/.node-red/node_modules/qs/lib/utils.js:~118] [pc=0x20067594](this=0x36c8438d <undefined>,str=0x43a423d1 <Very long string[17508]>)
3: arguments adaptor frame: 2->1
4: stringify(aka stringify) [0x4fdd737d] [/home/pi/.node-red/node_modules/qs/lib/stringify.js:61] [bytecode=0x289...
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
这意味着我的节点中有错误的节点?如果是,我如何找到哪个节点有错误?
错误的重要部分是:
fallback in old gen Allocation failed - JavaScript heap out of memory
这意味着 Node-RED 运行正在运行的 NodeJS 虚拟机 运行 内存不足。
如果不正确理解您的流程正在做什么,就不可能说出为什么会发生这种情况,但一个合理的猜测是您正在尝试处理(来自某处)传入消息的速度比它们到达时慢,或者可能是您将内容存储在 Context 中并且从不删除它们,因此它们会随着时间的推移而累积。
编辑:
OOM 的堆栈跟踪不一定有帮助,这正是在没有更多空间时尝试分配的内容。不代表就是原因。
如前所述,调试此问题的唯一方法是详细了解您的流程正在做什么(Stack Overflow 可能不是解决此问题的最佳场所。您可能在 Node-RED 上做得更好论坛或 slack,在那里您可能会找到可以与您一起解决问题的人)
问题出在错误的电报节点配置上。这在 qs/lib/utils.js:~118
中调用了 self 字符串更大,直到堆 space...
感谢