-
Notifications
You must be signed in to change notification settings - Fork 174
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
After some time of working, the PLC suddenly stopped responding to requests #329
Comments
You might want to format the code here so that it is readable. Then try to create a minimal reproducable example. Use the Modbus/TCP Server to see if it happens there too. |
I formatted the code |
Still too much code to look for an error. To me this doesn't seem to be related to the client logic. The line |
I noticed that there is a similar posting at yaacov/node-modbus-serial#502 I have had a problem with node-red-contrib-modbus (based on |
How many times do you call readHoldingRegisters before this happens? Are you using this over an intermittent internet connection? I have a very similar issue (ECONNREFUSED) and I have never been able to get to the bottom of it. The error rate is about 1 out of 100,000 and is impossible to replicate. I spent weeks troubleshooting it and at this point I am confident the issue isn't in my code. In my case it looks like a socket issue and its unclear if its caused by this library, node itself or the PLC. |
My error condition is also after hundreds of thousands, even millions of Modbus reads, takes days to happen. Currently running with >10 million reads and only 71 reads failed (which is fine, I use a very short timeout with no retry) and without having the flow crash. In my environment there is stable connection: all connected to a local Ethernet switch, not over WAN. As an experiment, I was going to try similar Modbus polling using NodeJS directly (not Node Red). See if that can run reliably. BTW @g-langlois: What hardware environment are you running in? |
Has any of you tried to setup a test environment with debug logs enabled? I am curious if this is related to this library? |
It is usually stopped after some failed requests either
2023-06-29T06:41:29.365Z startGettingData Timed out ETIMEDOUT
or
2023-06-29T06:33:26.760Z startGettingData Port Not Open ECONNREFUSED
or
2023-07-06T05:27:19.498Z connect ETIMEDOUT {IP}:{PORT} -110
HMI continues working correctly. Our system gets the responses after restarting the PLC or plugging out/in the LAN cable.
It issues accrues when code is deployed in AWS ECS. During the local deployment, we didn't face it yet.
I attempted to read both individual registers and multiple registers simultaneously. The issue persists. Interestingly, even though the requests count to PLC is lowered drastically, the issue arises more frequently in the case of reading several registers at once.
PLC Model:
The following is my setup:
main.js
plc.js
redis/index.js
handlers.js – getting several register values at once
handlers.js – getting one by one example
Could you kindly provide me with guidance on the appropriate direction to dig? Is it something related to latency or PLC capabilities? Or maybe there are some subtleties which are not considered in the code.
The text was updated successfully, but these errors were encountered: