-
Notifications
You must be signed in to change notification settings - Fork 2k
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
xtimer: periodic race #9595
xtimer: periodic race #9595
Conversation
Hm, now the period drifts on underflow, right? E.g., start is 0, period is 10, if one step at |
@kaspar030 thats correct. If this happens this means there are to much higher prior task, or they take to long, and the period can not be fullfilled. It would be cancelled out if this is only one period with high load. then the next target will be on spot again. But if it happpens every 10 period and If the period does not move the target will get closer to now. with this fix there will be a continues growing drift from the starting target, but the it will keep running. |
I guess this is a matter of expected / desired behaviour.
What would we expect? |
@kaspar030 this was the first fix. But for sure skipping and setting the next target in regard to the old target is a possible solution which would not introduce a jitter but only a drift. |
0d64a44
to
dbe13f2
Compare
I change the implementation so the past targets are skipped and the period is fixed. |
dbe13f2
to
4cdb29e
Compare
@kaspar030 @cladmi @gebart What would be the desired behaviour in your opinion? |
3518b88
to
a5bf1cc
Compare
1. Change targed passed criteria. 2. Recalculate last_wakeup to be a multiple of periods after now. This skips missed targets and avoids a race condition.
a5bf1cc
to
01db77e
Compare
Ping Pong |
@kYc0o @kaspar030 @cladmi @gebart seems there are still people having problems with this issue. Maybe someone could have time to look into this PR. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions. |
@MichelRottleuthner @JulianHolzwarth can you have a look if this PR is still valid after the xtimer rework? |
I'm closing this as xtimer is deprecated. Feel free to reopen if you disagree. |
This PR solves a race condition.
If the workload is high like in
test/xtimer_drift
and thelast_wakeup
is not updated with the proper time the next target might be also allready past now, dependend on the periode choosen.This PR sets the
last_wakeup
to now if the target is allready reached.EDIT:
I change the implementation so the past targets are skipped and the period is fixed.
Means past targets get skipped, one execution with hight jitter, next execution in periode with minimal jitter.
Tries to handle the same problem as #7629 submitted on 20 Sep 2017.