Conversation
The hot queue was walked with an iterator that lazily prefetches the successor through `next_hot` while `tick`'s loop body had already moved the previously returned task off the hot list (`make_cold` also clears its `next`). Whenever a task's poll re-entered `tick` on the same executor — nested driving, e.g. a synchronous harvest inside a thread-per-core runtime — the inner tick could transition the prefetched task from hot to cold. The outer iteration then either tripped `debug_assert!(item.is_hot)` on debug builds or silently truncated the walk on release builds, leaving queued tasks unpolled until the next tick. Handle the stale cursor explicitly: when the cursor's task is no longer hot, restart from the current hot head; and in the loop body, skip tasks that a nested tick has already taken off the hot list instead of asserting or polling them a second time. Re-entry is now crash-free and lossless, and the iteration still visits every queued task exactly once per tick when no nesting occurs.
x-at-01
force-pushed
the
fix/executor-tick-reentrant
branch
from
September 24, 2026 04:27
416f4df to
30b331e
Compare
Berrysoft
requested changes
Sep 24, 2026
Berrysoft
left a comment
Member
There was a problem hiding this comment.
Please separate your removal of unneeded dependencies to a dedicated PR.
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.
Problem
Executor::tickwalks the hot queue with an iterator that lazily prefetches the successor viaTaskQueue::next_hot, while the loop body has already moved the previously returned task off the hot list (make_coldalso clears itsnextpointer).Whenever a task's poll re-enters
tickon the same executor — nested driving, which happens in practice with a synchronous harvest inside a thread-per-core runtime (calling the low-levelrun/pollpair from within a task'spoll, in the spirit of a blocking-wait bridge) — the inner tick transitions the prefetched task from hot to cold (or completes and removes it). The outer iteration then:debug_assert!(item.is_hot)innext_hot, oritem.nextis alreadyNoneor task removed), leaving queued tasks unpolled until the next tick.Fix
Handle stale/non-hot cursors cleanly during iteration:
next_hot: when the cursor's task is no longer hot or has been removed from the map, fall back to the current hot head (inner.hot.head).Iter::next: verify that the cursor is currently hot before yielding. If non-hot/removed (e.g. processed by a nested tick, completed, or cancelled), advance directly fromhot_head()in a loop so non-hot tasks are skipped without wasting interval slots or causing double polls.tick's loop body: retain defense-in-depth checkqueue.is_hot(id)to prevent double polling under re-entrancy.