Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled exeption for variable named "error" #70

Closed
bergmanu opened this issue May 14, 2020 · 1 comment
Closed

Unhandled exeption for variable named "error" #70

bergmanu opened this issue May 14, 2020 · 1 comment

Comments

@bergmanu
Copy link

Describe the bug

If a variable in the s7 node is named "error", node-red crashes with unhandled exepction in the following cases:

  1. using single variable -> error with uncheckd "Emit only when value changes (diff)"
  2. using All variables with checked and unchecked "Emit only when value changes (diff)"
  3. 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
DB1

node-red only crashes if it can successfully connect to PLC.

Steps to reproduce the behavior:

  1. Import attached flow
  2. Deploy -> everything works
  3. Rename variable "test" to "error"
  4. Deploy -> still works
  5. uncheck "Emit only when value changes (diff)" for the error variable
  6. 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'

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

  • Version of this node: 2.1.1
  • Node-RED version: 1.0.2
  • PLC Part Number: PLCSim Advanced V3.0 (with S7-1515-2 PN)
  • OS for node-red: Debian 10 on Siemens IOT2050 (https://github.com/siemens/meta-iot2050)
  • OS for Browser: Windows 10
  • Browser: Chrome
@gfcittolin
Copy link
Member

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__.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants