Skip to content

Conversation

@akundaz
Copy link
Collaborator

@akundaz akundaz commented Jan 13, 2026

Remove these calls in the pipeline executor:

cx.waker().wake_by_ref();

This line tells the tokio executor to immediately poll the same future again, but since the cursor is not ready to advance yet, we end up going to that wake line very quickly because we don't do anything. This causes a hot loop in the tokio executor leading to heavy context switching.

@akundaz akundaz self-assigned this Jan 13, 2026
Copy link
Member

@julio4 julio4 left a comment

Choose a reason for hiding this comment

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

Nice good find on this hot reschedule loop! Just one issue that should fix tests as well and should be good to go


trace!("{} will execute step {path}", executor.pipeline);
let future = executor.execute_step(&path, input);
executor.cursor = Cursor::StepInProgress(path, future);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
executor.cursor = Cursor::StepInProgress(path, future);
executor.cursor = Cursor::StepInProgress(path, future);
cx.waker().wake_by_ref();

This wake is necessary because we have a new future/at a state transition boundary and directly return Poll::Pending without polling it first, so there would be no registered waker to drive progress without it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants