Closed checor closed 7 years ago
Hi, I'm using a server to simulate a modbus component and ECONNRESET happen sometimes. I don't know why, if someone can help. Thanks
@checor hi, thanks for the issue, I will look into it this weekend.
p.s. Your snippet look ok, so it's probably something with the lib. You can run the programs ( simulator and reader ) with debug, maybe you will see something you do not see now:
export DEBUG=modbus-serial
node simulator.js
@yaacov Thanks for the fast reply! I will run the snippet with debugging enabled. If I find anything, I will post the results.
Hello, i'm using the Modbus Server to mock a controller where i should connect, and every time i restart the client (master) application the server crashes.
I think the server should handle the socket error event that happens when the client abruptly closes the connection. Alternative, an event might be exposed to be handled by user's code.
As a workaround i'm using:
process.on('uncaughtException', function (err) { console.error(err.stack); });
Anyway, @yaacov big thumbs up for the library!
@uwburn Thanks
p.s. If you can make a pull request with a fix, it will be very nice, I do not find the time to fix this ...
I will try to help with that too. I want to get my hands in Node.
2017-07-12 11:02 GMT-05:00 Yaacov Zamir notifications@github.com:
@uwburn https://github.com/uwburn Thanks
p.s. If you can make a pull request with a fix, it will be very nice, I do not find the time to fix this ...
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/yaacov/node-modbus-serial/issues/116#issuecomment-314816436, or mute the thread https://github.com/notifications/unsubscribe-auth/ADbZIuZuEfm-qW_DtK50vfrw3F-HepQNks5sNO4sgaJpZM4N3e5w .
@yaacov: i will try to get a grasp on it.
Submitted pull request #122.
Will merge once tests are green.
On windows the linter went crazy, so i just ignored it... my bad. I tested again on linux and fixed linter complaints.
The bad side is that on Linux i could not get the ECONNRESET error to trigger on the server. I'm spawning a child process that opens the connection to the server and then killing it: on Windows when the process is killed the socket is closed abruptly and ECONNRESET is triggered, but on Linux it doesn't happen.
I think i cannot implement a test for this, is that ok?
I think i cannot implement a test for this, is that ok?
yes, thanks for the work ! I will try to make the test work and merge it when I do, you can try too :-).
Ok, i later on i will update the PR. I will leave the test case for ECONNRESET commented, so the test will not fail and you can see the idea behind it.
fixed by #122
Hello, I'm trying this library. I choose it because seems easier to use and it's pure js, compared to another libraries. Congrats on your work!
However, I feel I'm missing something too obvious since almost every time something someone connects and ask for data, the programs crashes.
I added some parameters that changes over time to the modbus server example, in order to simulate a PLC.
I uploaded the snippet here: https://gist.github.com/checor/6217b145a6601f6aff81da1cd6df092d
I added some variables that need to change over time. I don't know if it's interferes with the Modbus library, I'm a js amateur 😞
Here are the error strings I encounter usually:
Almost everytime a PLC disconnects/shuts down. From what I found about this error, I need to handle it myself, since it's a connection reset.
When reading a coil. With this error I don't have a clue what is the cause.
Any assistance would be greatly appreciated.