Skip to content
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

"Data Loss!" #1925

Open
kengruven opened this issue Nov 22, 2023 · 2 comments
Open

"Data Loss!" #1925

kengruven opened this issue Nov 22, 2023 · 2 comments

Comments

@kengruven
Copy link
Contributor

I was playing with the new web interface and not seeing any action from my fixtures, so I ran ola_dmxmonitor to make sure the data was getting sent to OLA. Every now and then, it pops up a little text alert that says "Data Loss!".

There doesn't seem to be any documentation anywhere which says what data is being lost, or if this is a problem, or what I should do about it. Or is this a bug? Intuitively, I wouldn't think that moving one slider in a web interface, with one terminal window monitoring the state of 500 bytes, should be enough to cause any kind of data loss.

@kengruven
Copy link
Contributor Author

This warning seems to be generated by

if (diff > TimeInterval(2, 5000000)) {
which is a really weird line.

According to the TimeInterval header (and USEC_IN_SECONDS), it's seconds and microseconds, so this looks like it means 2 seconds + 5 million microseconds = 7 seconds.

But the usec field is stored in type suseconds_t, which according to POSIX is only required to hold values in the range [-1, 1000000], and I can't find any documentation on what it might do when given a value outside of this range. (Wrap? Ignore? Overflow into the seconds field?)

My computer is pretty new, has lots of idle cores, plenty of RAM, and an SSD, and I can see the DMX monitor continuously update. I doubt it's ever gone even 1 second without a screen update. Whatever this code was intended to do, I'm skeptical it's actually doing that.

@kengruven
Copy link
Contributor Author

It looks like a lot of the functionality (TimerAdd, TimerSub, Set, etc) assumes that the microsecond count is in the range [0,999999]. That's a perfectly reasonable invariant, but it's never checked or enforced.

I'd propose:

  1. Update TimeInterval (or its base class) to check/enforce the range of its inputs
  2. Fix ola-dmxmonitor.cpp to not pass an out-of-range value here: I assume the intent was USEC_IN_SECONDS / 2?
  3. Document what "Data Loss!" means here. Or rename it: it seems to mean "dropped frame", which is common terminology in many other contexts

It looks like the current line (using glibc) is probably equivalent to:

if (diff > TimeInterval(3, 0)) {

but I'm still skeptical that a terminal window constantly displaying updates of 1/2 KB of data is ever exceeding 3sec of lag.

@kengruven kengruven changed the title Documentation request: "Data Loss!" "Data Loss!" Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant