Polling issue with high register number with Arduino via Modbus
-
JoelHaggar, yes, I have tried that. My current settings are with 10 max read/write registers.
The "funny thing" is that I am also having aborted polls when only 6 - 10 registers are involved in total.
Nevertheless, my current settings for this data source with 49 registers is as shown below.
-
The update period of 1000 milliseconds could that collide when the timeout is twice as long ?
The read bit count is that overall total ie the sum of all 10 registers ?
-
I agree, you should not have the timeout X retries longer than your update rate. I would slow down your update rate to 5 or 10 seconds to see if things improve. You can also use the test tools to do one time reads and see if you get anything.
-
update rate must be >timeout*(retries+1),and max read bit count=16*register. just fyi
-
stensma, JoelHaggar, hussam, thanks for your answers, this helped a lot!
I changed update period to 1200 ms, timeout to 500 ms with 1 retry, max read bit count to 160 and max read/write register count to 10. No aborted polls and timeouts so far after 0,5 h run, nevertheless, I will test it further.
What is still present is error I see in log and command window, the content is as below:
(com.serotonin.io.serial.JsscSerialPortInputStream.serialEvent:134) - java.lang.NullPointerException
I get it every 5 - 8 ms, then there is ~50 ms break, and it starts again. I suppose the error occurs every time something is calculated/updated but I cannot get what might be wrong here.
-
I tested this settings further (and even some others) and the problem is still present. Just after launch of both Arduino and Mango it goes good for circa 40 minutes, then there is a series of 10 to 20 timeouts lasting from 1 to 3 minutes and then can be a 5 minutes break for normal working or even smaller. Sometimes errors start to appear even 5 minutes after launch.
I even tried 1000 ms retry and 3000 ms update period but no success, the rate of occurring errors is similar. Any hints what to do now?
-
Can you print more of the stack trace for that NullPointerException?
-
phildunlap, thanks for your post.
Below, you can find my current settings (I believe they have an impact on error appearing rate). The whole log with started "Modbus" data source is here: http://pasted.co/7265b7d4
-
Hi copytco,
I took a look at where those NullPointerExceptions are coming from. I'm not sure it will solve your problem, but it could help sort the issue out a little. I modified this JsscSerialPortInputStream to 1) check for a null buffer and return (where I believe that mess of Exceptions are coming from) and 2) output a better error message from errors during the read. Have you seen if there's anything interesting in your Modbus log?
You may also want to move your Mango/classes/debug-log4j.xml to Mango/classes/log4j.xml and rename the existing log4j configuration. This way you'll get debug messages for serial port receive events and whatnot.
If you place the attached .class file into your Mango/overrides/classes/com/infiniteautomation/mango/io/serial/ directory and restart Mango, it should use this modified class instead.
JsscSerialPortInputStream.class
Having this file could conflict with future upgrades, so consider removing it after testing. In general, we do not support overridden class situations. You may have to rename the file to "JsscSerialPortInputStream.class"
-
Thank you, phildunlap.
I did what you have written - moved debug-log4j.xml in place of log4j.xml, created overrides folder and subfolders, and placed the file provided by you in there. Here is the log I received: http://pasted.co/d6b935a0
I do not know much about how Modbus works "inside", but I here is the log I received for this session: http://pasted.co/10adedb5
-
How interesting! It looks like there is a duplicate class in sero-utils and my override isn't being loaded. sero-utils pulled our Jssc code! This is quite bizarre... nothing in Mango references com.serotonin.io.serial.JsscSerialPortInputStream!
Edit The below probably won't work, the package in the java is wrong! Sorry!
Well, that's probably your issue. Try placing a copy of that .class file I gave you in Mango/overrides/classes/com/serotonin/io/serial/ as well. I will investigate why it's using the Jssc from sero utils...
-
Hi, I tried placing the file into serotonin folder and when tried to enable my data source, got an error as shown below.
What could I do about it now?
-
So is there any way of solving that problem? I see than I encounter the same error message even on fresh install of Mango when creating Modbus data source and defining at least one data point.
-
Hi copytco! Sorry for the delay.
Let's try this again....
JsscSerialPortInputStream.classThis time it's the one for the Mango/overrides/classes/com/serotonin/io/serial/ directory. I am hoping the stack trace will shed more light on what could be null in that method. I'm thinking the origin is the native library for the jssc. If so, another thing to try would be to attempt communication from a different computer to the arduino. I hope being able to read the stack trace sheds some light, though.
-
Thanks, phildunlap, I used your file and this is the log I received: http://pasted.co/6ac92888
-
Hi copytco, glad that class worked! I was able to get a little more information. Can you try this attached .class in that same location ( com/serotonin/io/serial ) and let me know if it's still occurring?
-
Thanks, I see that there is no longer error message, but some other appeared. Details are here: http://pasted.co/ae06e69d To know if it resolves the aborted polls issue, I would need to let it run for couple of hours.
-
Great! I do not know what you are referring to, "but some other appeared." The only errors I see relate to your meta points having some disabled points in the context. Remember, we turned on debug logging! Please let me know if that fixes the issue for you, and I can discuss the modification I made with the other developers for integration.
-
Thanks, unfortunately I still experience those errors mentioned in the first post. Though, they seem to be a little bit less intensive.
-
How bizarre. Like I said, I think part of the error is from the native portion of the JSSC, so perhaps you could have better luck on a *nix system. It would be nontrivial to troubleshoot this more through the forum. Would you mind providing a couple details? Like, what version of windows are you using? Can you confirm the errors are still from com.serotonin.io.serial.JsscSerialPortInputStream?
My understanding of what I think it going on is that JSSC is reporting an RX event, and then we're requesting to read the number of bytes the event purports to contain. This null would suggest an RX event occurred purporting more bytes than it had (or than are actually in the buffer), which would suggest a deeper problem.