nodejs / node

Node.js JavaScript runtime ✨🐢🚀✨
https://nodejs.org
Other
106.98k stars 29.24k forks source link

net-module does't react when pulling of the cable (embedded Linux) #8048

Closed sembaye closed 8 years ago

sembaye commented 8 years ago

Hallo everyone,

i have a problem that I want to discuss. I'm using the npm module nodes7 to communicate with a Siemens-PLC, an industrial computer for automating processes. NodeS7 uses the net-module to create a socket for the whole communication.

Now the problem: I'm reading cyclic values from the plc. To simulate a connection error I pulled off the Ethernet cable. I tested the reaction of my software on three OS. Windows, Ubuntu VM and the destination system an embedded Linux. Each of them behave different. The Windows-OS and Ubuntu VM are stopping the communication which is good. With the emb. Linux nothing happens. I debugged the net module to see what's happening in it.

The following picture shows the log-files of each OS. difference - email

left shell=Windows: after a Timeout of the nodeS7-library the net-module detects an ECONNRESET middle shell=Ubuntu: after a Timeout of the nodeS7-library the net-module detects an EOF right shell=embedded Linux: nothing is getting detected

When you have a look on the src-code of the net-module you can see that the debug-log onread is getting created within the onread-function. The on-read function is always called whenever the handle gets a buffer, or when there's an error reading.

Well, I have a reading error. What I am doing wrong??? Any ideas?

bnoordhuis commented 8 years ago

Node.js merely bubbles up the error from the operating system, or nothing if the OS doesn't report it. I don't think this is a bug as such.

I see you've reported it over at https://github.com/nodejs/help/issues/247 and https://github.com/plcpeople/nodeS7/issues/12 already so I'll close this issue.

sembaye commented 8 years ago

OK