fix: [DSM-103] Reliably burn down idle canisters' positive AP#10255
Merged
alin-at-dfinity merged 1 commit intoMay 19, 2026
Merged
Conversation
The scheduler does not remove canisters from the schedule as soon as they become idle. Instead, in order to ensure that a canister with huge negative AP does not get scheduled with neutral priority (i.e. AP=0) a couple of rounds later simply by becoming idle for a round; and, similarly, to preserve some AP for canisters that accumulated a lot of it before getting executed and then became idle; we keep canisters in the schedule until their AP reaches zero before dropping them. Canisters with negative AP simply accumulate it same as active canisters; and positive AP canisters get charged every round as if they had a full execution (which they would have, had they had a small input). The problem with the latter is that, on a mostly idle subnet, in the presence of a few canisters with heartbeats accumulating negative AP, an idle canister with positive AP cannot burn it down fast enough to compensate for the free priority resulting from charging the heartbeat canisters. The mitigation is to stop distributing free priority to idle canisters with positive AP, ensuring that they soon reach zero AP.
michael-weigelt
approved these changes
May 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The scheduler does not remove canisters from the schedule as soon as they become idle. Instead, in order to ensure that a canister with huge negative accumulated priority (AP) does not get scheduled with neutral priority (i.e. AP=0) a couple of rounds later by simply becoming idle for a round; and similarly, to preserve some AP for a couple of rounds for canisters that accumulated a lot of it before getting executed and becoming idle; we keep canisters in the schedule until their AP reaches zero, before dropping them. Canisters with negative AP simply accumulate it the same as active canisters; and positive AP canisters get charged every round as if they had a full execution round (which they would have, had they had any inputs).
The problem with the latter is that, on a mostly idle subnet, in the presence of a few canisters with heartbeats accumulating negative AP, an idle canister with positive AP cannot burn it down fast enough to compensate for the free priority that results from charging it and the heartbeat canisters.
The mitigation is to stop distributing free priority to idle canisters with positive AP, ensuring that they quickly reach AP=0.