-
Notifications
You must be signed in to change notification settings - Fork 838
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
pallet-scheduler: Put back postponed tasks into the agenda #7790
base: master
Are you sure you want to change the base?
Conversation
Right now `pallet-scheduler` is not putting back postponed tasks into the agenda when the early weight check is failing. This pull request ensures that these taks are put back into the agenda and are not just "lost".
/cmd prdoc --audience runtime-dev --bump patch |
Command "prdoc --audience runtime-dev --bump patch" has failed ❌! See logs here |
/cmd prdoc --audience runtime_dev --bump patch |
All GitHub workflows were cancelled due to failure one of the required jobs. |
…kadot-sdk into bkchr-scheduler-postponed
let base_weight = T::WeightInfo::service_task( | ||
task.call.lookup_len().map(|x| x as usize), | ||
task.maybe_id.is_some(), | ||
task.maybe_periodic.is_some(), | ||
); | ||
if !weight.can_consume(base_weight) { | ||
postponed += 1; | ||
agenda[agenda_index as usize] = Some(task); |
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.
I see, so this is what was missing from before: the task would have been take
n above, and not put back in the agenda.
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.
Yes
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.
The change looks good, but I don't understand another part of the code,
if service_task
fails, we put back the task into agenda, even when error is Unavailable
.
polkadot-sdk/substrate/frame/scheduler/src/lib.rs
Lines 1254 to 1267 in 5439b5f
agenda[agenda_index as usize] = match result { | |
Err((Unavailable, slot)) => { | |
dropped += 1; | |
slot | |
}, | |
Err((Overweight, slot)) => { | |
postponed += 1; | |
slot | |
}, | |
Ok(()) => { | |
*executed += 1; | |
None | |
}, | |
}; |
But in service_task
we do return some task with error Unavailable
when:
- getting the preimage failed
- the execution fails because it is overweight and it is the first task
If any of these case happen, the task will stay forever on the agenda of the block and brick the agenda no?
It feels like it should be dropped instead.
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
Co-authored-by: Alexandre R. Baldé <alexandre.balde@parity.io>
Co-authored-by: Alexandre R. Baldé <alexandre.balde@parity.io>
Right now
pallet-scheduler
is not putting back postponed tasks into the agenda when the early weight check is failing. This pull request ensures that these tasks are put back into the agenda and are not just "lost".