How to track down Uncaught Exception

note* this issue is intermittent, over the last days its happens perhaps 3 times out of maybe 100 deploys.

I noticed instead of Deploying when I press the Deploy button on the editor, Node-Red restarts, first I thought perhaps I pressed Restart Flows on the Deploy menu because I was not taking enough notice what I was doing, but today I figured I had a problem and checked the logs see below.

here is the log ... how can I narrow down the issue I have huge multiple flows.

May 7 10:52:39 raspberrypi Node-RED[32577]: 7 May 10:52:39 - [red] Uncaught Exception:
May 7 10:52:39 raspberrypi Node-RED[32577]: 7 May 10:52:39 - TypeError: Cannot set property 'socketid' of undefined
May 7 10:52:39 raspberrypi Node-RED[32577]: at Object.beforeSend (/home/pi/.node-red/node_modules/node-red-dashboard/nodes/ui_template.js:79:33)
May 7 10:52:39 raspberrypi Node-RED[32577]: at EventEmitter.handler (/home/pi/.node-red/node_modules/node-red-dashboard/ui.js:285:26)
May 7 10:52:39 raspberrypi Node-RED[32577]: at emitOne (events.js:121:20)
May 7 10:52:39 raspberrypi Node-RED[32577]: at EventEmitter.emit (events.js:211:7)
May 7 10:52:39 raspberrypi Node-RED[32577]: at emitOne (events.js:116:13)
May 7 10:52:39 raspberrypi Node-RED[32577]: at Socket.emit (events.js:211:7)
May 7 10:52:39 raspberrypi Node-RED[32577]: at /home/pi/.node-red/node_modules/socket.io/lib/socket.js:528:12
May 7 10:52:39 raspberrypi Node-RED[32577]: at _combinedTickCallback (internal/process/next_tick.js:131:7)
May 7 10:52:39 raspberrypi Node-RED[32577]: at process._tickDomainCallback (internal/process/next_tick.js:218:9)
May 7 10:52:39 raspberrypi systemd[1]: nodered.service: Main process exited, code=exited, status=1/FAILURE

What versions of node-red, node-red-dashboard and nodejs are you running? The easiest way to answer may be to run, in a terminal
node-red-stop
node-red-start
and post the output here.

Hi @Dave,

the stack trace includes node-red-dashboard/nodes/ui_template.js - so that points at one of your ui_template nodes.

However, this sort of error should not be left uncaught like this and an issue should be raised against node-red-dashboard so appropriate error handling can be added.

Before you do that, as Colin says, please confirm what version of Node-RED Dashboard you are using - just in case you are on an older version and this is already resolved in a more recent version.

/cc @dceejay for FYI

node-red 1.0.1
node-red-dashboard 2.19.4
nodejs v8.11.3

There was a previous report of the problem, suggesting that it is to do with the same template multiple times, but @max did not respond to a request for further information.

Hi Colin I don't think @max problem is the same one that I have, sure I am using many ui-template nodes (192) some are buttons but these have been working for a long time without issue, the only time I am hitting this intermittent problem is when I am modifying some thing and I press the Deploy button, the last time I had this problem (yesterday) I was not modifying the same flow as I was today, however both times I was working on different ui_template nodes.

For sure this issue is not happening at any other time, I have multiple checks that alert me via prowl if something goes off-line but one sure fire way of telling is that I have two usb nas hard drives that are controlled via buttons on this pi if node-red restarts the usb's drop out and require a reboot to get them working again.

I can see this issue is going to be a pig to narrow down I think the best thing I can do is to continue doing what I am doing and monitor carefully to see if I can find some common causality, without more data its going to be like trying to find a needle in a haystack.

If you could still raise an issue on https://github.com/node-red/node-red-dashboard/issues that would be helpful.

It may be a pain to track down, but nothing a user does should cause an uncaught exception.

The stack trace points to this line:

                if (original) {
                    var om = original.msg;
                    om.socketid = original.socketid; // <------
                    return om;
                }

meaning, for some reason, original.msg is undefined at this point in time. I don't know enough of the inner workings of dashboard to say why that could be. But if we can get an issue raised that we can look at it properly.

Thanks.

Yes - if the template is "bad" and doesn't send a proper object (ie null) then yes - oops.
Fixed in master on npm now. Now released as v2.22.0.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.