node-ethernet-ip
node-ethernet-ip copied to clipboard
Process crash when using destroy methods
Current Behavior
On a specific devices or/and particular network failures , use the destroy method to ends the devices connection will end all the process
10 Jan 11:09:35 - Error: This socket has been ended by the other party
at Controller.writeAfterFIN [as write] (net.js:407:14)
at Controller.destroy (/home/aurelien/repos/braincubeiot2-contrib-ethernetip/.bin/red/ethernetip.js:1118:14)
at destroyPLC (/home/aurelien/repos/braincubeiot2-contrib-ethernetip/.bin/red/ethernetip.js:8162:31)
Expected Behavior
Normally when a socket is gone don't try to write something on it.
Possible Solution (Optional)
Apply this changement in your destroy method like that
destroy(exception) {
const { unregisterSession } = encapsulation;
if(this.destroyed) return ;
this.write(unregisterSession(this.state.session.id), () => {
this.state.session.established = false;
super.destroy();
});
}
Context
My connection pass through a proxy and fucked up some times. And close connections.
Steps to Reproduce (for bugs only)
- Make a connection to your plc
- Disconnect it mecanicly
- Apply the destroy method
- See whats happened !
Your Environment
- Package version (Use
npm list
- e.g. 1.0.6): 6.9.0 - Node Version (Use
node --version
- e.g. 9.8.0): 12.2.0 - Operating System and version: linux debian 10
- Controller Type (eg 1756-L83E/B): 1756-L83
- Controller Firmware (eg 30.11): 30.12