Deploy requires more than one attempt

I can't put my finger on exactly when this condition started happening. Sometime in the last two weeks or so.

When I click deploy, about 75% of the time, the first try fails and I have to click deploy again. I experience this condition when i try to deploy both Full and Modified flows.

When the first attempt fails, sudo journalctl -f -n 25 -o cat shows nothing related to Node-RED.

Node-RED v0.19.4
Ubuntu 16.04.6 LTS
Release: 16.04
Codename:xenial

Next time it happens, look in the browser JavaScript console for any errors.

Error processing windowTypes: This property is deprecated [global.min.js:250](moz-extension://b7d0005b-5048-f541-8ddc-26fdb5b79842/global.min.js)

makeError resource://gre/modules/Schemas.jsm:459

logDeprecation resource://gre/modules/Schemas.jsm:1109

checkDeprecated resource://gre/modules/Schemas.jsm:1121

normalizeBase resource://gre/modules/Schemas.jsm:1236

normalize resource://gre/modules/Schemas.jsm:1924

r resource://gre/modules/Schemas.jsm:1666

withPath resource://gre/modules/Schemas.jsm:544

checkProperty resource://gre/modules/Schemas.jsm:1666

normalize resource://gre/modules/Schemas.jsm:1727

normalize resource://gre/modules/Schemas.jsm:1366

fixedArgs resource://gre/modules/Schemas.jsm:2256

map self-hosted:286

checkParameters resource://gre/modules/Schemas.jsm:2251

stub resource://gre/modules/Schemas.jsm:2334

a moz-extension://b7d0005b-5048-f541-8ddc-26fdb5b79842/global.min.js:250

apply self-hosted:4638

applySafeWithoutClone resource://gre/modules/ExtensionCommon.jsm:539

fire resource://gre/modules/ExtensionChild.jsm:994

receiveMessage resource://gre/modules/ExtensionChild.jsm:997

_callHandlers resource://gre/modules/MessageChannel.jsm:876

_callHandlers resource://gre/modules/MessageChannel.jsm:875

promise resource://gre/modules/MessageChannel.jsm:952

_handleMessage resource://gre/modules/MessageChannel.jsm:949

_handleMessage self-hosted:987

receiveMessage resource://gre/modules/MessageChannel.jsm:218

forEach self-hosted:262

receiveMessage resource://gre/modules/MessageChannel.jsm:211

Empty string passed to getElementById().

[vendor.js:2:24489](http://192.168.14.178:1880/vendor/vendor.js)

Empty string passed to getElementById().

[vendor.js:2:24489](http://192.168.14.178:1880/vendor/vendor.js)

Firefox can’t establish a connection to the server at ws://192.168.14.178:1880/comms. [red.min.js:16:9313](http://192.168.14.178:1880/red/red.min.js)

Firefox can’t establish a connection to the server at ws://192.168.14.178:1880/comms. [red.min.js:16:9313](http://192.168.14.178:1880/red/red.min.js)

Empty string passed to getElementById().

[vendor.js:2:24489](http://192.168.14.178:1880/vendor/vendor.js)

Error processing windowTypes: This property is deprecated [global.min.js:250](moz-extension://b7d0005b-5048-f541-8ddc-26fdb5b79842/global.min.js)

a is undefined [global.min.js:250](moz-extension://b7d0005b-5048-f541-8ddc-26fdb5b79842/global.min.js)

Unchecked lastError value: Error: Invalid window ID: 14 [global.min.js:250](moz-extension://b7d0005b-5048-f541-8ddc-26fdb5b79842/global.min.js)

The browser console contents for the event above and a second consecutive failure:

Error processing windowTypes: This property is deprecated [global.min.js:250](moz-extension://b7d0005b-5048-f541-8ddc-26fdb5b79842/global.min.js)

makeError resource://gre/modules/Schemas.jsm:459

logDeprecation resource://gre/modules/Schemas.jsm:1109

checkDeprecated resource://gre/modules/Schemas.jsm:1121

normalizeBase resource://gre/modules/Schemas.jsm:1236

normalize resource://gre/modules/Schemas.jsm:1924

r resource://gre/modules/Schemas.jsm:1666

withPath resource://gre/modules/Schemas.jsm:544

checkProperty resource://gre/modules/Schemas.jsm:1666

normalize resource://gre/modules/Schemas.jsm:1727

normalize resource://gre/modules/Schemas.jsm:1366

fixedArgs resource://gre/modules/Schemas.jsm:2256

map self-hosted:286

checkParameters resource://gre/modules/Schemas.jsm:2251

stub resource://gre/modules/Schemas.jsm:2334

a moz-extension://b7d0005b-5048-f541-8ddc-26fdb5b79842/global.min.js:250

apply self-hosted:4638

applySafeWithoutClone resource://gre/modules/ExtensionCommon.jsm:539

fire resource://gre/modules/ExtensionChild.jsm:994

receiveMessage resource://gre/modules/ExtensionChild.jsm:997

_callHandlers resource://gre/modules/MessageChannel.jsm:876

_callHandlers resource://gre/modules/MessageChannel.jsm:875

promise resource://gre/modules/MessageChannel.jsm:952

_handleMessage resource://gre/modules/MessageChannel.jsm:949

_handleMessage self-hosted:987

receiveMessage resource://gre/modules/MessageChannel.jsm:218

forEach self-hosted:262

receiveMessage resource://gre/modules/MessageChannel.jsm:211

Empty string passed to getElementById().

[vendor.js:2:24489](http://192.168.14.178:1880/vendor/vendor.js)

Empty string passed to getElementById().

[vendor.js:2:24489](http://192.168.14.178:1880/vendor/vendor.js)

Firefox can’t establish a connection to the server at ws://192.168.14.178:1880/comms. [red.min.js:16:9313](http://192.168.14.178:1880/red/red.min.js)

Firefox can’t establish a connection to the server at ws://192.168.14.178:1880/comms. [red.min.js:16:9313](http://192.168.14.178:1880/red/red.min.js)

Empty string passed to getElementById().

[vendor.js:2:24489](http://192.168.14.178:1880/vendor/vendor.js)

Error processing windowTypes: This property is deprecated [global.min.js:250](moz-extension://b7d0005b-5048-f541-8ddc-26fdb5b79842/global.min.js)

a is undefined [global.min.js:250](moz-extension://b7d0005b-5048-f541-8ddc-26fdb5b79842/global.min.js)

Unchecked lastError value: Error: Invalid window ID: 14 [global.min.js:250](moz-extension://b7d0005b-5048-f541-8ddc-26fdb5b79842/global.min.js)

Error processing windowTypes: This property is deprecated [global.min.js:250](moz-extension://b7d0005b-5048-f541-8ddc-26fdb5b79842/global.min.js)

Content Security Policy: The page’s settings blocked the loading of a resource at https://discourse.nodered.org/t/deploy-requires-more-than-one-attempt/12208 (“base-uri”).

Deprecation notice: Removing all event listeners at once is deprecated, please remove each listener individually. [application-7e90d098ca29ed6222a1c89d26afd5e076c02e640108d024f2ab8de030da3a71.js:1:15153](https://sjc1.discourse-cdn.com/business6/brotli_asset/application-7e90d098ca29ed6222a1c89d26afd5e076c02e640108d024f2ab8de030da3a71.js)

Deprecation notice: Removing all event listeners at once is deprecated, please remove each listener individually. [application-7e90d098ca29ed6222a1c89d26afd5e076c02e640108d024f2ab8de030da3a71.js:1:15153](https://sjc1.discourse-cdn.com/business6/brotli_asset/application-7e90d098ca29ed6222a1c89d26afd5e076c02e640108d024f2ab8de030da3a71.js)

Error processing windowTypes: This property is deprecated [global.min.js:250](moz-extension://b7d0005b-5048-f541-8ddc-26fdb5b79842/global.min.js)

Error processing windowTypes: This property is deprecated [global.min.js:250](moz-extension://b7d0005b-5048-f541-8ddc-26fdb5b79842/global.min.js)

makeError resource://gre/modules/Schemas.jsm:459

logDeprecation resource://gre/modules/Schemas.jsm:1109

checkDeprecated resource://gre/modules/Schemas.jsm:1121

normalizeBase resource://gre/modules/Schemas.jsm:1236

normalize resource://gre/modules/Schemas.jsm:1924

r resource://gre/modules/Schemas.jsm:1666

withPath resource://gre/modules/Schemas.jsm:544

checkProperty resource://gre/modules/Schemas.jsm:1666

normalize resource://gre/modules/Schemas.jsm:1727

normalize resource://gre/modules/Schemas.jsm:1366

fixedArgs resource://gre/modules/Schemas.jsm:2256

map self-hosted:286

checkParameters resource://gre/modules/Schemas.jsm:2251

stub resource://gre/modules/Schemas.jsm:2334

a moz-extension://b7d0005b-5048-f541-8ddc-26fdb5b79842/global.min.js:250

apply self-hosted:4638

applySafeWithoutClone resource://gre/modules/ExtensionCommon.jsm:539

fire resource://gre/modules/ExtensionChild.jsm:994

receiveMessage resource://gre/modules/ExtensionChild.jsm:997

_callHandlers resource://gre/modules/MessageChannel.jsm:876

_callHandlers resource://gre/modules/MessageChannel.jsm:875

promise resource://gre/modules/MessageChannel.jsm:952

_handleMessage resource://gre/modules/MessageChannel.jsm:949

_handleMessage self-hosted:987

receiveMessage resource://gre/modules/MessageChannel.jsm:218

forEach self-hosted:262

receiveMessage resource://gre/modules/MessageChannel.jsm:211

Empty string passed to getElementById().

[vendor.js:2:24489](http://192.168.14.178:1880/vendor/vendor.js)

Empty string passed to getElementById().

[vendor.js:2:24489](http://192.168.14.178:1880/vendor/vendor.js)

Firefox can’t establish a connection to the server at ws://192.168.14.178:1880/comms. [red.min.js:16:9313](http://192.168.14.178:1880/red/red.min.js)

Firefox can’t establish a connection to the server at ws://192.168.14.178:1880/comms. [red.min.js:16:9313](http://192.168.14.178:1880/red/red.min.js)

Error processing windowTypes: This property is deprecated [global.min.js:250](moz-extension://b7d0005b-5048-f541-8ddc-26fdb5b79842/global.min.js)

makeError resource://gre/modules/Schemas.jsm:459

logDeprecation resource://gre/modules/Schemas.jsm:1109

checkDeprecated resource://gre/modules/Schemas.jsm:1121

normalizeBase resource://gre/modules/Schemas.jsm:1236

normalize resource://gre/modules/Schemas.jsm:1924

r resource://gre/modules/Schemas.jsm:1666

withPath resource://gre/modules/Schemas.jsm:544

checkProperty resource://gre/modules/Schemas.jsm:1666

normalize resource://gre/modules/Schemas.jsm:1727

normalize resource://gre/modules/Schemas.jsm:1366

fixedArgs resource://gre/modules/Schemas.jsm:2256

map self-hosted:286

checkParameters resource://gre/modules/Schemas.jsm:2251

stub resource://gre/modules/Schemas.jsm:2334

a moz-extension://b7d0005b-5048-f541-8ddc-26fdb5b79842/global.min.js:250

apply self-hosted:4638

applySafeWithoutClone resource://gre/modules/ExtensionCommon.jsm:539

fire resource://gre/modules/ExtensionChild.jsm:994

receiveMessage resource://gre/modules/ExtensionChild.jsm:997

_callHandlers resource://gre/modules/MessageChannel.jsm:876

_callHandlers resource://gre/modules/MessageChannel.jsm:875

promise resource://gre/modules/MessageChannel.jsm:952

_handleMessage resource://gre/modules/MessageChannel.jsm:949

_handleMessage self-hosted:987

receiveMessage resource://gre/modules/MessageChannel.jsm:218

forEach self-hosted:262

receiveMessage resource://gre/modules/MessageChannel.jsm:211

a is undefined [global.min.js:250](moz-extension://b7d0005b-5048-f541-8ddc-26fdb5b79842/global.min.js)

a moz-extension://b7d0005b-5048-f541-8ddc-26fdb5b79842/global.min.js:250

apply self-hosted:4638

applySafeWithoutClone resource://gre/modules/ExtensionCommon.jsm:539

wrapPromise resource://gre/modules/ExtensionCommon.jsm:752

withLastError resource://gre/modules/ExtensionCommon.jsm:676

wrapPromise resource://gre/modules/ExtensionCommon.jsm:744

Unchecked lastError value: Error: Invalid window ID: 14 [global.min.js:250](moz-extension://b7d0005b-5048-f541-8ddc-26fdb5b79842/global.min.js)

a moz-extension://b7d0005b-5048-f541-8ddc-26fdb5b79842/global.min.js:250

The connection to wss://qa.sockets.stackexchange.com/ was interrupted while the page was loading. [full-anon.en.js:1:4375](https://cdn.sstatic.net/Js/full-anon.en.js?v=250fd39bcf2a)

Error processing windowTypes: This property is deprecated [global.min.js:250](moz-extension://b7d0005b-5048-f541-8ddc-26fdb5b79842/global.min.js)

makeError resource://gre/modules/Schemas.jsm:459

logDeprecation resource://gre/modules/Schemas.jsm:1109

checkDeprecated resource://gre/modules/Schemas.jsm:1121

normalizeBase resource://gre/modules/Schemas.jsm:1236

normalize resource://gre/modules/Schemas.jsm:1924

r resource://gre/modules/Schemas.jsm:1666

withPath resource://gre/modules/Schemas.jsm:544

checkProperty resource://gre/modules/Schemas.jsm:1666

normalize resource://gre/modules/Schemas.jsm:1727

normalize resource://gre/modules/Schemas.jsm:1366

fixedArgs resource://gre/modules/Schemas.jsm:2256

map self-hosted:286

checkParameters resource://gre/modules/Schemas.jsm:2251

stub resource://gre/modules/Schemas.jsm:2334

a moz-extension://b7d0005b-5048-f541-8ddc-26fdb5b79842/global.min.js:250

apply self-hosted:4638

applySafeWithoutClone resource://gre/modules/ExtensionCommon.jsm:539

fire resource://gre/modules/ExtensionChild.jsm:994

receiveMessage resource://gre/modules/ExtensionChild.jsm:997

_callHandlers resource://gre/modules/MessageChannel.jsm:876

_callHandlers resource://gre/modules/MessageChannel.jsm:875

promise resource://gre/modules/MessageChannel.jsm:952

_handleMessage resource://gre/modules/MessageChannel.jsm:949

_handleMessage self-hosted:987

receiveMessage resource://gre/modules/MessageChannel.jsm:218

forEach self-hosted:262

receiveMessage resource://gre/modules/MessageChannel.jsm:211

Error processing windowTypes: This property is deprecated [global.min.js:250](moz-extension://b7d0005b-5048-f541-8ddc-26fdb5b79842/global.min.js)

makeError resource://gre/modules/Schemas.jsm:459

logDeprecation resource://gre/modules/Schemas.jsm:1109

checkDeprecated resource://gre/modules/Schemas.jsm:1121

normalizeBase resource://gre/modules/Schemas.jsm:1236

normalize resource://gre/modules/Schemas.jsm:1924

r resource://gre/modules/Schemas.jsm:1666

withPath resource://gre/modules/Schemas.jsm:544

checkProperty resource://gre/modules/Schemas.jsm:1666

normalize resource://gre/modules/Schemas.jsm:1727

normalize resource://gre/modules/Schemas.jsm:1366

fixedArgs resource://gre/modules/Schemas.jsm:2256

map self-hosted:286

checkParameters resource://gre/modules/Schemas.jsm:2251

stub resource://gre/modules/Schemas.jsm:2334

a moz-extension://b7d0005b-5048-f541-8ddc-26fdb5b79842/global.min.js:250

apply self-hosted:4638

applySafeWithoutClone resource://gre/modules/ExtensionCommon.jsm:539

fire resource://gre/modules/ExtensionChild.jsm:994

receiveMessage resource://gre/modules/ExtensionChild.jsm:997

_callHandlers resource://gre/modules/MessageChannel.jsm:876

_callHandlers resource://gre/modules/MessageChannel.jsm:875

promise resource://gre/modules/MessageChannel.jsm:952

_handleMessage resource://gre/modules/MessageChannel.jsm:949

_handleMessage self-hosted:987

receiveMessage resource://gre/modules/MessageChannel.jsm:218

forEach self-hosted:262

receiveMessage resource://gre/modules/MessageChannel.jsm:211

a is undefined [global.min.js:250](moz-extension://b7d0005b-5048-f541-8ddc-26fdb5b79842/global.min.js)

a moz-extension://b7d0005b-5048-f541-8ddc-26fdb5b79842/global.min.js:250

apply self-hosted:4638

applySafeWithoutClone resource://gre/modules/ExtensionCommon.jsm:539

wrapPromise resource://gre/modules/ExtensionCommon.jsm:752

withLastError resource://gre/modules/ExtensionCommon.jsm:676

wrapPromise resource://gre/modules/ExtensionCommon.jsm:744

Unchecked lastError value: Error: Invalid window ID: 14 [global.min.js:250](moz-extension://b7d0005b-5048-f541-8ddc-26fdb5b79842/global.min.js)

a moz-extension://b7d0005b-5048-f541-8ddc-26fdb5b79842/global.min.js:250

That error is coming from some extension you have installed in the browser. It is not node-red.

1 Like

Thanks for the quick response! I didn't think to look in the browser console.

I only have two extensions: 1Password and Cisco Webex. Both are now disabled and it seems to have made a difference.

I would look to that being the culprit initially. Depending on what version you are using. I always keep it turned off and only turn in on when I have to use the c**ppy service from CISCO. I use the "SimpleExtManage" Chrome extension to be able to turn on/off extensions quickly.

This week's sprint is going to be dedicated to resolving this condition, which still persists. However, I am certain that I don't know where to start in the diagnosis. I have read a few posts to which some of you have contributed related to JavaScript heap out of memory and they are pretty CSI-like in their forensics.

I have validated that I can cause a JavaScript heap out of memory condition when I hit Deploy. See example log data below, which was created when I tried to deploy a change using Safari. I usually use Firefox, so I don't think that this is browser-dependent.

I have removed all browser extensions from Firefox.

There is also some kind of time element. After an initial failure, or two, I can usually deploy changes without incident as long as I don't wait too long between deployments. If I wait for something that feels likt 15 or 20 minutes, the heap error will occur.

For the first time, I have received this message this morning:

6/17/2019, 7:06:22 AMmsg : string[27]
"Existing flow file is empty"
6/17/2019, 7:06:23 AM
msg : string[122]
"Restoring flow file backup : /home/homemanadmin/.node-red/projects/nodered-homeassistant/.flows_homeMan-server.json.backup"

From time-to-time, this condition will occur when I access my node-red instance from my browser (i.e. http://192.168.14.178:1880) for the first time at the beginning of the day. Such was the case this morning. The Browser Console shows the following:


OpenGL compositor Initialized Succesfully.
Version: 2.1 INTEL-10.36.25
Vendor: Intel Inc.
Renderer: Intel(R) Iris(TM) Graphics 6100
FBO Texture Target: TEXTURE_2D
Unkown category for SetEventRecordingEnabled.
[Exception... "Favicon at "https://sjc1.discourse-cdn.com/favicon.ico" failed to load: Not Found."  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: resource:///modules/FaviconLoader.jsm :: onStopRequest :: line 199"  data: no]
window.controllers/Controllers is deprecated. Do not use it for UA detection. ace.js:1:18479
Content Security Policy: Ignoring ‘x-frame-options’ because of ‘frame-ancestors’ directive.
The connection to ws://192.168.14.178:1880/comms was interrupted while the page was loading. red.min.js:16:9313
window.controllers/Controllers is deprecated. Do not use it for UA detection. ace.js:1:18479
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user’s experience. For more help http://xhr.spec.whatwg.org/ vendor.js:5:25379
OpenGL compositor Initialized Succesfully.
Version: 2.1 INTEL-10.36.25
Vendor: Intel Inc.
Renderer: Intel(R) Iris(TM) Graphics 6100
FBO Texture Target: TEXTURE_2D
XHRGEThttps://aus5.mozilla.org/update/3/GMP/67.0.2/20190607204818/Darwin_x86_64-gcc3/en-US/release/Darwin%2017.7.0/default/default/update.xml
[HTTP/2.0 200 OK 1722ms]


As mentioned earlier, this will happen randomly when I am not working in node-red.

Typical top output during steady state on my Ubuntu server. If memory usage is spiking, i am not sure where i can find that historical evidence.

top - 05:46:42 up 2 days, 22:13,  1 user,  load average: 0.00, 0.00, 0.01
Tasks: 132 total,   1 running, 131 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.5 us,  0.2 sy,  0.0 ni, 99.2 id,  0.0 wa,  0.0 hi,  0.2 si,  0.0 st
KiB Mem :  3963868 total,  1200036 free,   340512 used,  2423320 buff/cache
KiB Swap:  4108284 total,  4108284 free,        0 used.  3267164 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                                                                      
20927 homeman+  20   0  934156 174224  29680 S   0.0  4.4   0:14.10 node-red                                                                                                     
 2013 homeass+  20   0 1475236 138844  22236 S   1.0  3.5  11:38.08 hass                                                                                                         
 1200 root      20   0  174624  19692  11604 S   0.0  0.5   0:00.10 unattended-upgr                                                                                              
  948 root      20   0  286936   8092   7144 S   0.0  0.2   0:03.58 accounts-daemon                                                                                              
 1320 root      20   0  288180   7740   6916 S   0.0  0.2   0:00.03 polkitd                                                                                                      
20762 root      20   0   92832   6836   5904 S   0.0  0.2   0:00.02 sshd                                                                                                         
    1 root      20   0  120144   6232   4056 S   0.0  0.2   0:03.34 systemd                                                                                                      
 1329 root      20   0   65512   6092   5384 S   0.0  0.2   0:00.00 sshd                                                                                                         
20849 homeman+  20   0   22860   5644   3484 S   0.0  0.1   0:00.17 bash                                                                                                         
20848 homeman+  20   0   94244   5348   3116 S   0.0  0.1   0:00.28 sshd                                                                                                         
  471 root      20   0   45820   5304   3180 S   0.0  0.1   0:00.79 systemd-udevd                                                                                                
  382 root      20   0   40640   5132   2672 S   0.0  0.1   0:04.78 systemd-journal                                                                                              
 1286 mosquit+  20   0   42224   4884   4300 S   0.0  0.1   0:40.51 mosquitto                                                                                                    
20764 homeman+  20   0   45288   4628   3920 S   0.0  0.1   0:00.01 systemd                                                                                                      
  909 message+  20   0   43032   4088   3520 S   0.0  0.1   0:00.27 dbus-daemon                                                                                                  
21000 homeman+  20   0   41812   3860   3252 R   0.0  0.1   0:00.07 top                                                                                                          
 1236 root      10 -10    5720   3528   2444 S   0.0  0.1   0:11.27 iscsid                                                                                                       
  959 syslog    20   0  256392   3440   2824 S   0.0  0.1   0:02.59 rsyslogd                                                                                                     
  907 root      20   0   28620   3192   2864 S   0.0  0.1   0:00.22 systemd-logind                                                                                               
  953 root      20   0   29008   3048   2776 S   0.0  0.1   0:00.24 cron                                                                                                         
 1047 root      20   0   16124   2884   2028 S   0.0  0.1   0:00.00 dhclient                                                                                                     
  810 systemd+  20   0  100324   2552   2340 S   0.0  0.1   0:00.16 systemd-timesyn                                                                                              
  931 root      20   0  309668   2452   1452 S   0.0  0.1   0:02.02 lxcfs                                                                                                        
 1206 root      20   0   24048   2288   1932 S   0.0  0.1   0:00.00 vsftpd                                                                                                       
20765 homeman+  20   0  143596   2288      0 S   0.0  0.1   0:00.00 (sd-pam)                                                                                                     
  940 daemon    20   0   26044   2168   1976 S   0.0  0.1   0:00.00 atd                                                                                                          
 1310 root      20   0   15936   1828   1692 S   0.0  0.0   0:00.00 agetty                                                                                                       
  438 root      20   0  102968   1804   1576 S   0.0  0.0   0:00.00 lvmetad                                                                                                      
  944 root      20   0    4396   1220   1132 S   0.0  0.0   0:00.00 acpid                                                                                                        
 1314 root      20   0   19472    252      0 S   0.0  0.0   0:06.91 irqbalance                                                                                                   
  992 root      20   0   13372    164     20 S   0.0  0.0   0:00.01 mdadm                                                                                                        
 1235 root      20   0    5220    148     36 S   0.0  0.0   0:02.10 iscsid                                                                                                       
    2 root      20   0       0      0      0 S   0.0  0.0   0:00.01 kthreadd  

Example log entries.

<--- Last few GCs --->
[20878:0x30b2060]   261842 ms: Mark-sweep 120.3 (133.8) -> 119.6 (133.8) MB, 179.5 / 0.0 ms  (average mu = 0.155, current mu = 0.051) allocation failure scavenge might not succeed
[20878:0x30b2060]   262035 ms: Mark-sweep 120.5 (133.8) -> 119.8 (133.3) MB, 180.0 / 0.0 ms  (average mu = 0.114, current mu = 0.070) allocation failure scavenge might not succeed
<--- JS stacktrace --->
==== JS stack trace =========================================
    0: ExitFrame [pc: 0x360c1434fb5d]
Security context: 0x12df3009d9f1 <JSObject>
    1: _clone(aka _clone) [0x357d3e728509] [/usr/lib/node_modules/node-red/node_modules/clone/clone.js:~73] [pc=0x360c14ae14c2](this=0x2d0671f025b1 <undefined>,0x21b317a14ca1 <Object map = 0x2298466fbf11>,0x10f6ed4e3051 <HeapNumber inf>)
    2: clone(aka clone) [0x243e5265761] [/usr/lib/node_modules/node-red/node_modules/clone/clone.js:~52] [pc=0x360c14adeda...
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0x944930 node::Abort() [node-red]
 2: 0x9457dc node::OnFatalError(char const*, char const*) [node-red]
 3: 0xb0d01e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node-red]
 4: 0xb0d254 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node-red]
 5: 0xf09822  [node-red]
 6: 0xf09928 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [node-red]
 7: 0xf16048 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [node-red]
 8: 0xf16b5b v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node-red]
 9: 0xf19891 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [node-red]
10: 0xee3ac4 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [node-red]
11: 0x11994ae v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [node-red]
12: 0x360c1434fb5d
2019-06-17 05:32:24 ERROR (MainThread) [aiohttp.server] Unhandled exception
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 448, in start
    await resp.write_eof()
  File "/srv/homeassistant/lib/python3.6/site-packages/aiohttp/web_response.py", line 444, in write_eof
    await self._payload_writer.write_eof(data)
  File "/srv/homeassistant/lib/python3.6/site-packages/aiohttp/http_writer.py", line 138, in write_eof
    self._write(chunk)
  File "/srv/homeassistant/lib/python3.6/site-packages/aiohttp/http_writer.py", line 67, in _write
    raise ConnectionResetError('Cannot write to closing transport')
ConnectionResetError: Cannot write to closing transport
2019-06-17 05:32:24 ERROR (MainThread) [aiohttp.server] Unhandled exception
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 448, in start
    await resp.write_eof()
  File "/srv/homeassistant/lib/python3.6/site-packages/aiohttp/web_response.py", line 444, in write_eof
    await self._payload_writer.write_eof(data)
  File "/srv/homeassistant/lib/python3.6/site-packages/aiohttp/http_writer.py", line 138, in write_eof
    self._write(chunk)
  File "/srv/homeassistant/lib/python3.6/site-packages/aiohttp/http_writer.py", line 67, in _write
    raise ConnectionResetError('Cannot write to closing transport')
ConnectionResetError: Cannot write to closing transport
2019-06-17 05:32:24 ERROR (MainThread) [aiohttp.server] Unhandled exception
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 448, in start
    await resp.write_eof()
  File "/srv/homeassistant/lib/python3.6/site-packages/aiohttp/web_response.py", line 444, in write_eof
    await self._payload_writer.write_eof(data)
  File "/srv/homeassistant/lib/python3.6/site-packages/aiohttp/http_writer.py", line 138, in write_eof
    self._write(chunk)
node-red.service: Main process exited, code=dumped, status=6/ABRT
  File "/srv/homeassistant/lib/python3.6/site-packages/aiohttp/http_writer.py", line 67, in _write
    raise ConnectionResetError('Cannot write to closing transport')
ConnectionResetError: Cannot write to closing transport
node-red.service: Unit entered failed state.
node-red.service: Failed with result 'core-dump'.
node-red.service: Service hold-off time over, scheduling restart.
Stopped Node-RED.
Started Node-RED.
[UFW BLOCK] IN=enp0s25 OUT= MAC=01:00:5e:00:00:01:c0:56:27:cb:c7:ee:08:00 SRC=192.168.14.97 DST=224.0.0.1 LEN=28 TOS=0x00 PREC=0xC0 TTL=1 ID=58886 PROTO=2 
17 Jun 05:32:24 - [info]
Welcome to Node-RED
===================

When a click on Deploy is successful, this is in the Browser Console


XHRGEThttp://192.168.14.178:1880/context/flow/bfe5449b.615498
[HTTP/1.1 200 OK 497ms]

Empty string passed to getElementById().
vendor.js:2:24489
XHRPOSThttp://192.168.14.178:1880/flows
[HTTP/1.1 200 OK 3495ms]

Empty string passed to getElementById().
vendor.js:2:24489
XHRGEThttp://192.168.14.178:1880/projects/nodered-homeassistant/status
[HTTP/1.1 304 Not Modified 254ms]


Is it possible that having too many sequences and/or too many nodes in a flow could cause the JavaScript heap overflow?

My irrigation flow is my largest. I have disabled this flow to test to see if it makes a difference. I have posted it here.

Well, maybe not. The flow export is 185K characters and the post limit is 32K.

My irrigation flow had 277 nodes. I have just made a change that resulted in a reduction by 55. This change has made a dramatic improvement in the behavior. I have been able to Deploy without incident after making this change.

For reference, my live flow file is 626k (1025 nodes).

-rw-r--r--   1 pi pi 626K Jun 15 13:19 flows.json

Oddly, my secondary instance isn't much smaller though it has a lot less in it - 409k (655 nodes).

I have no problems with either.

TotallyInformation,

Thanks for the reference. The numbers i quoted above (185k and 277 nodes) were for the contents of a single flow tab. My flows file is 851,289. How did you count the nodes across all tabs? That would be useful to know how to do.

How cool is that.

Interesting enough: I copied the sequence, created a new flow tab, pasted the sequence, hit Deploy, and...... yup:

21 Jun 05:45:24 - [info] Stopping modified flows
21 Jun 05:45:24 - [info] Stopped modified flows
21 Jun 05:45:24 - [info] Starting modified flows
21 Jun 05:45:24 - [info] Started modified flows
<--- Last few GCs --->
[7369:0x3438060] 30355722 ms: Mark-sweep 116.8 (136.8) -> 113.0 (136.8) MB, 123.5 / 0.0 ms  (average mu = 0.300, current mu = 0.273) allocation failure scavenge might not succeed
[7369:0x3438060] 30355918 ms: Mark-sweep 116.9 (136.8) -> 113.2 (136.8) MB, 120.5 / 0.0 ms  (average mu = 0.346, current mu = 0.387) allocation failure scavenge might not succeed
<--- JS stacktrace --->
==== JS stack trace =========================================
    0: ExitFrame [pc: 0x33bb8f8cfb5d]
Security context: 0x0a294ba1d9f1 <JSObject>
    1: delegateYield [0x24e2a4a3c679] [/usr/lib/node_modules/node-red/node_modules/jsonata/jsonata-es5.js:~9191] [pc=0x33bb90019935](this=0x20a63e507289 <Context map = 0x252007bc1c21>,0x20a63e507741 <Object map = 0x5b328b833d1>,0x2113bf30abe1 <String[2]: t1>,11)
    2: evaluatePath$(aka evaluatePath$) [0x20a63e507211] [/usr/lib/node_modules/node-red/node_mod...
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0x944930 node::Abort() [node-red]
 2: 0x9457dc node::OnFatalError(char const*, char const*) [node-red]
 3: 0xb0d01e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node-red]
 4: 0xb0d254 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node-red]
 5: 0xf09822  [node-red]
 6: 0xf09928 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [node-red]
 7: 0xf16048 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [node-red]
 8: 0xf16b5b v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node-red]
 9: 0xf19891 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [node-red]
10: 0xee3ac4 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [node-red]
11: 0x11994ae v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [node-red]
12: 0x33bb8f8cfb5d
2019-06-21 05:45:28 ERROR (MainThread) [aiohttp.server] Unhandled exception
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 448, in start
    await resp.write_eof()
  File "/srv/homeassistant/lib/python3.6/site-packages/aiohttp/web_response.py", line 444, in write_eof
    await self._payload_writer.write_eof(data)
  File "/srv/homeassistant/lib/python3.6/site-packages/aiohttp/http_writer.py", line 138, in write_eof
    self._write(chunk)
  File "/srv/homeassistant/lib/python3.6/site-packages/aiohttp/http_writer.py", line 67, in _write
    raise ConnectionResetError('Cannot write to closing transport')
ConnectionResetError: Cannot write to closing transport
TOTAL: 1448
actionflows: 1
actionflows_in: 1
actionflows_out: 1
api-call-service: 123
api-current-state: 127
catch: 12
change: 361
comment: 11
debug: 35
delay: 47
file: 9
file in: 2
function: 62
inject: 87
json: 4
moment: 11
mqtt in: 5
mqtt out: 15
mqtt-broker: 2
schedex: 25
server: 5
server-events: 2
server-state-changed: 120
simple-queue: 2
simpletime: 13
start-up-trigger: 1
string: 26
subflow: 216
sun events: 1
switch: 86
tab: 15
time-range-switch: 11
twilio out: 7
twilio-api: 1
ui_base: 1

Ah, thanks for that! Because I've got a nice update for that flow that gives more accurate results and compares a JSONata with a function node approach. I'll update it in a sec.

You may wish to pick up the revised version of that flow and run it again.

You do have a lot of nodes it is true.

The revised version will differentiate between subflow definitions and subflow instances.

OK, so as you still have the issue, you will need to look to try and optimise things slightly.

This is a bit of a black art as there are lots of edge cases that can turn the normal advice on its head. You can also end up trading off a memory issue with a CPU issue if not careful.

So there are two V8 settings you can use to see if they help your issues:

  • --optimize-for-size - it seems that this can make a large difference but it can also raise CPU levels unacceptably.
  • --max-old-space-size - tweaking this can remove stack overflows but again remember that the old space garbage collection is quite slow and gets slower the larger the space allocated.

You can find the current old-space size with the v8.getHeapSpaceStatistics() function, see here.

What to set it too depends on lots of factors, probably best to increase it piecemeal until the problem goes away then increase it a little more. Assuming you have the memory on your target device of course.

One other tool that looks interesting for trying to diagnose these issues is node-clinic. I've not tried it yet but it might be helpful.

Thanks for the info. Not that I can be reckless, but per the top display above, i am using but a thimble full of resources on my ubuntu machine. I'll rtfm and start tweaking.

Happy Friday!

TotallyInformation,

I have read in the forum that calling function nodes can introduce overhead. Are you able to confirm this.

Now that I am starting to get some Node-RED experience, it is my plan to refactor all of my function nodes because I have discovered nodes -- and JSONata in the change node, which is the bomb -- that can replace almost all of them.

One more quick question. Do you have any idea why clicking on a node in Search results will most often take me to white space at the bottom right corner of the flow?

There is an overhead due to the fact that they use a Node.js VM (protected scripting environment). However, it isn't a massive overhead and unless you are really pushing the throughput to the limit, I doubt you would notice.

A word of caution, and one of the reasons I included both options in my updated flow ... JSONata itself hasn't always been the most efficient of things - though I think it has probably improved greatly.

More importantly, it is one of those tools that will lead you down a long, dark path sometimes. My personal advice would be that if you can't do something quickly and fairly obviously in JSONata, you are almost certainly better off doing it in a function node. Not only will you find the design taking exponentially longer as things get more complex, you will likely find that you can't understand what on earth you did or why after a few months!

I have a few design patterns that I know well in JSONata and I like to use those as they are clear and obvious. A quick twist of JSON into another form is often a good use-case too. But sometimes it is just a lot easier to write and think about a more traditional approach with a loop or map or whatever in plain JavaScript.

Maybe that's just me though, I am a bit long in the tooth so it is possible that I'm simply a lot more used to working one way than the other (though there is a lot of analytics and multi-dimensional data manipulation in my dim and distant professional past).

No, I'm afraid not. Not doing that for me. Maybe check your browser's developer console to see if any errors are being produced. Start a new thread perhaps to help chase that down. Don't forget to tell people what version of Node, Node-RED and browser you are using.