If a variable in the s7 node is named "error", node-red crashes with unhandled exepction in the following cases:
using single variable -> error with uncheckd "Emit only when value changes (diff)"
using All variables with checked and unchecked "Emit only when value changes (diff)"
using All variables, one per message with checked and unchecked "Emit only when value changes (diff)"
Whereas it doesn't crash using single variable -> error with checked "Emit only when value changes (diff)"
To Reproduce
For reproducing you need a PLC with DB1. It contains in my example the variables in the screenshot
node-red only crashes if it can successfully connect to PLC.
Steps to reproduce the behavior:
Import attached flow
Deploy -> everything works
Rename variable "test" to "error"
Deploy -> still works
uncheck "Emit only when value changes (diff)" for the error variable
Deploy -> node-red crashes
Expected behavior
The s7 node reads out the variables in any case, it shouldn't matter how they are named
Logs
14 May 08:30:39 - [red] Uncaught Exception:
14 May 08:30:39 - Error [ERR_UNHANDLED_ERROR]: Unhandled error. (true)
at S7Endpoint.emit (events.js:187:17)
at S7Endpoint.Node.emit (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:185:20)
at /home/root/.node-red/node_modules/node-red-contrib-s7/red/s7.js:343:26
at Array.forEach (<anonymous>)
at NodeS7.cycleCallback [as readDoneCallback] (/home/root/.node-red/node_modules/node-red-contrib-s7/red/s7.js:340:33)
at NodeS7.readResponse (/home/root/.node-red/node_modules/nodes7/nodeS7.js:1447:9)
at NodeS7.onResponse (/home/root/.node-red/node_modules/nodes7/nodeS7.js:1243:9)
at Socket.<anonymous> (/home/root/.node-red/node_modules/nodes7/nodeS7.js:418:20)
at Socket.emit (events.js:198:13)
at addChunk (_stream_readable.js:288:12)
node-red.service: Main process exited, code=exited, status=1/FAILURE
node-red.service: Failed with result 'exit-code'
This variable name is indeed not supported because it's a reserved event name on Node.JS. There is also other internal reserved names like __ALL__, __CHANGED__, __ALL_CHANGED__ and __STATUS__.
Describe the bug
If a variable in the s7 node is named "error", node-red crashes with unhandled exepction in the following cases:
Whereas it doesn't crash using single variable -> error with checked "Emit only when value changes (diff)"
To Reproduce
For reproducing you need a PLC with DB1. It contains in my example the variables in the screenshot
node-red only crashes if it can successfully connect to PLC.
Steps to reproduce the behavior:
Expected behavior
The s7 node reads out the variables in any case, it shouldn't matter how they are named
Logs
Flow
[{"id":"74a983bd.c83efc","type":"s7 in","z":"f8907b7a.5fd9e8","endpoint":"6f2223c.71411dc","mode":"single","variable":"status","diff":true,"name":"","x":150,"y":100,"wires":[[]]},{"id":"a085508f.6f5ca","type":"s7 in","z":"f8907b7a.5fd9e8","endpoint":"6f2223c.71411dc","mode":"single","variable":"statusID","diff":true,"name":"","x":160,"y":160,"wires":[[]]},{"id":"82995af9.3f7168","type":"s7 in","z":"f8907b7a.5fd9e8","endpoint":"6f2223c.71411dc","mode":"single","variable":"bool1","diff":true,"name":"","x":150,"y":220,"wires":[[]]},{"id":"5b686495.d97afc","type":"s7 in","z":"f8907b7a.5fd9e8","endpoint":"6f2223c.71411dc","mode":"single","variable":"test","diff":true,"name":"","x":150,"y":280,"wires":[[]]},{"id":"f2c93088.6b76","type":"s7 in","z":"f8907b7a.5fd9e8","endpoint":"6f2223c.71411dc","mode":"single","variable":"bool2","diff":true,"name":"","x":150,"y":340,"wires":[[]]},{"id":"6f2223c.71411dc","type":"s7 endpoint","z":"","transport":"iso-on-tcp","address":"192.168.200.60","port":"102","rack":"0","slot":"1","localtsaphi":"01","localtsaplo":"00","remotetsaphi":"01","remotetsaplo":"00","connmode":"rack-slot","adapterauto":true,"adapterport":"","busaddr":"2","adapteraddr":"0","cycletime":"500","timeout":"1500","verbose":"default","name":"","vartable":[{"addr":"DB1,WORD0","name":"status"},{"addr":"DB1,INT2","name":"statusID"},{"addr":"DB1,X4.0","name":"bool1"},{"addr":"DB1,X4.1","name":"test"},{"addr":"DB1,X4.2","name":"bool2"}]}]
Environment