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
Duplicate callbacks from ioLoop.PeriodicCallback #366
Comments
I'm sorry, can you explain the problematic scenario in a little more detail? If current_time is equal to _next_timeout, why shouldn't it run the callback again immediately? Is this a problem with the resolution of time.time()? |
Yes, if time.time() had infinite resolution then this wouldn't be a problem. But at least on some systems, successive calls to time.time() will return equal values. So the problematic scenario is as follows: |
I'll make this change, since time.time() isn't always accurate to the microsecond, but 5 seconds is an awfully long time. If you're seeing a 5 second PeriodicCallback run into this issue, the problem is something more than just a lack of resolution. Maybe NTP adjustments, or something related to virtualization? |
Really it's independent of the interval. The issue is that time.time() returns the same value twice if you call it really quickly, e.g. on a fast machine with a callback that doesn't do much processing. The 'callback_time' interval never comes into play, since the while loop bypasses incrementing when time.time() didn't change. |
Ah, I see now. Thanks for the explanation. What platform are you seeing this on, by the way? |
Was afraid you'd ask ;) I've only seen this problem on our Windows XP On Tue, Oct 4, 2011 at 11:04 AM, bdarnell <
|
Was occasionally seeing multiple callback invocations in a single PeriodicCallback interval.
The problem is with the _schedule_next() function. On a fast machine, the current_time can be equal to the _next_timeout!
The fix in PeriodicCallback._schedule_next() is to change:
to:
The text was updated successfully, but these errors were encountered: