volkszaehler / mbmd

ModBus Measurement Daemon - simple reading of data from ModBus meters and grid inverters
BSD 3-Clause "New" or "Revised" License
229 stars 81 forks source link

Latest nightly - Modbus TCP - Gaps in Reading #277

Closed isarrider closed 2 years ago

isarrider commented 2 years ago

Hi,

compared to the build I made on June 11 (with the current master branch then), the latest nightly has gaps (like every 7s one reading) in reading for me... See picture attached - revert to the nightly before the commit in the ~last 20%... Clipboard01

The commit afterwards - thought it is only related to Modbus RTU?

BR, Alex

andig commented 2 years ago

Can you bisect to the breaking commit?

isarrider commented 2 years ago

basically already did, as only one commit is after (the other only changes the systemd requirements for startup)

andig commented 2 years ago

Which commit?

isarrider commented 2 years ago

if its no other ting, must be #265

andig commented 2 years ago

That will add timeout for TCP, too: https://github.com/volkszaehler/mbmd/pull/265/files#diff-30e0f5e75378b29cffb17ecc20d5fe46e5fbf95b4952a60cb55cba0ade588e37R92. Can you try if increasing the timeout fixes your problem?

isarrider commented 2 years ago

was afraid of that (whats the default timeout in contrast to before the commit?) Ill figure out how to add this in the config file and post the result here...

isarrider commented 2 years ago

couldnt figure out until now where the timeout can be specified in the config.yaml (https://github.com/volkszaehler/mbmd/blob/master/mbmd.dist.yaml) Ill try to use an edited source file with:

const DefaultTimeout = 900 * time.Millisecond

in commons.go

tobima commented 2 years ago

The default should be unchanged and still be 300ms.

You could use the cmdline parameter --timeout to change the timeout. E,g. '--timeout 600ms' to change the timeout to 600ms. The format for the duration is documented here: https://pkg.go.dev/time#ParseDuration

I haven't invest any time so far to understand how the config file.

isarrider commented 2 years ago

ok, it seems with the 900ms, the timeout doenst occur for me anymore, I get measurements now every second... (latest nightly b2590ae (compiled with go1.19)) Maybe the timeout should be by default higher than 300ms?

isarrider commented 2 years ago

closing it here...