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

Process crash when using destroy methods #63

Open
aurelhann opened this issue Jan 10, 2020 · 0 comments
Open

Process crash when using destroy methods #63

aurelhann opened this issue Jan 10, 2020 · 0 comments

Comments

@aurelhann
Copy link

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)

  1. Make a connection to your plc
  2. Disconnect it mecanicly
  3. Apply the destroy method
  4. 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
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

1 participant