-
Notifications
You must be signed in to change notification settings - Fork 18
Skip any missed timer events updating the timer to now #104
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
Skip any missed timer events updating the timer to now #104
Conversation
mdavidsaver
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kiwichris Could you describe the situation you are seeing leading to a lockup? Which timer and timer queue are involved? From context, I guess the effect is a live lock?
src/misc/timer.cpp
Outdated
| * the timer's run time to now and avoid the timer | ||
| * spinning issuing callbacks for missed timer events | ||
| */ | ||
| if ((now - work->timeToRun) > work->period) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the earlier
... (waitfor = queue.front()->timeToRun - now) ...It would make more sense to me to express this condition as:
if (waitfor < -work->period) {|
@mdavidsaver (per RTEMS Discord discussion) The callback being run due to this bug is |
This stops a timer calling the callback for every missed event if the time jumps forward when corrected or moved.
88deb5a to
b02545d
Compare
|
@kiwichris I have rebased this PR, and pushed an additional commit. Please have a look and see if you agree with this addition. For clarify, I reuse the previously calculated |
b02545d to
143ad93
Compare
|
❌ Build pvDataCPP 1.0.63 failed (commit f797fe82d8 by @kiwichris) |
143ad93 to
ba02097
Compare
|
❌ Build pvDataCPP 1.0.67 failed (commit 8e926f8386 by @mdavidsaver) |
|
❌ Build pvDataCPP 1.0.68 failed (commit e3a9ded505 by @mdavidsaver) |
|
❌ Build pvDataCPP 1.0.67 failed (commit e3a9ded505 by @mdavidsaver) |
|
I think this is enough of an improvement for now. |
Sorry about the delay responding, I was away last week. Thanks for review and changes. They looks good and I have tested it on my setup and I do not see the start up lock up. |
This stops a timer calling the callback for every missed event if the time jumps forward when corrected or moved.
The PR stops the EPICS shell locking up with NTP if no NTP server is available for RTEMS init to use or that request fails. The jump from the RTEMS epoch to the current time resulted the timer making all the missed timer calls which was a lot. The timer and callback looped until finished.