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

pallet-scheduler: Put back postponed tasks into the agenda #7790

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

bkchr
Copy link
Member

@bkchr bkchr commented Mar 3, 2025

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".

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".
@bkchr bkchr added the T2-pallets This PR/Issue is related to a particular pallet. label Mar 3, 2025
@bkchr bkchr requested a review from a team as a code owner March 3, 2025 22:27
@bkchr
Copy link
Member Author

bkchr commented Mar 3, 2025

/cmd prdoc --audience runtime-dev --bump patch

Copy link
Contributor

github-actions bot commented Mar 3, 2025

Command "prdoc --audience runtime-dev --bump patch" has failed ❌! See logs here

@bkchr
Copy link
Member Author

bkchr commented Mar 3, 2025

/cmd prdoc --audience runtime_dev --bump patch

@paritytech-workflow-stopper
Copy link

All GitHub workflows were cancelled due to failure one of the required jobs.
Failed workflow url: https://github.com/paritytech/polkadot-sdk/actions/runs/13641989048
Failed job name: test-linux-stable

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);
Copy link
Contributor

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 taken above, and not put back in the agenda.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

Copy link
Contributor

@gui1117 gui1117 left a 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.

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.

bkchr and others added 3 commits March 4, 2025 08:05
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T2-pallets This PR/Issue is related to a particular pallet.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants