SerafinTech / ST-node-ethernet-ip

Connect to PLC controllers with Node and Ethernet/ip
MIT License
36 stars 20 forks source link

EPIPE exception causes 'Maximum Callstack Size Exceeded' error #29

Closed Jon-Biz closed 1 year ago

Jon-Biz commented 1 year ago

Current Behavior

On an exception, the ENIP class's destroy function attempts to write to the TCP socket, to gracefully close it. But, if the exception was caused by unexpectedly closed socket, this results in an endless loop.

Expected Behavior

The destroy function should not attempt to write to a closed socket, triggering an exception.

Possible Solution (Optional)

If the exception.code is EPIPE, don't write to the socket.

https://github.com/Jon-Biz/ST-node-ethernet-ip/commit/010de84d7f86659a94e2dd80a8a4ceb973f24f57

Context

I was attempting to set up node-red to work with eth-ip messaging. Whenever I closed the ethip server simulator, node-red crashed.

Steps to Reproduce (for bugs only)

  1. Set up an eth-ip connection in node-red
  2. Disconnect the server you are connected to.
  3. Alternately, start node-red with the server offline.

Your Environment