"Connection Lost" issue while processing in Node Red

I'm having trouble with the NodeRed UI (Version 1.2.2) where I'm getting constant connection lost messages when I'm processing data through my nodes. Once Node regains connection, it refreshes the tab which breaks the UI. I've tested this on both IE and Google Chrome and had the same issue.

Connection Lost:

Developer tools provide the following error messages:
image

Does anyone have any advice? :slight_smile:

What OS/hardware are you running on?
Stop node red and start it in a terminal and post the full startup log here up to the point of failure please. That may give us some clues.

Hi Colin,

Thanks for the reply!

It's being run on MS Windows Server 2012.

It doesn't exactly fail. The flow keeps processing but the connection lost on the UI message appears and the UI doesn't update until it gains a connection again. We have Nodes that take A LOT of time as they're processing a huge amount of data.

This is the start up:

Node red is basically single threaded, so if you are locking up the processor for significant periods then 'connection lost' is exactly what is to be expected, as node-red is not able to service the connection to the browser.
Can you split up the processing so that things are able to happen between the chunks? Alternatively (probably better) offload the processing into another process? Possibly via exec nodes or a separate process interfacing via MQTT or http or something.

[Edit] However suggest you address the error in the log first in case it is a factor.

1 Like

If you explain (and perhaps add a screenshot or two) we might be able to direct you to a better arrangement. e.g. if you are looping (in a function) a large array of data, then it would be likely improve things (for the dashboard) if that was sent through a split node for example.

As Colin said, node-red is single threaded and most of its benefits & speed come from event based processing as opposed to single threaded blocking operations.

Another avenue to look at is to post progress of the processes to MQTT and use a 2nd instance for dashboard. Note however, the same thing stands - if you lock up the process in loop in a function, there is no chance for the MQTT messages to be sent.