Skip to content

Tokio timeout stuck on a loop. #4821

Answered by Noah-Kennedy
galeaspablo asked this question in Q&A
Discussion options

You must be logged in to vote

So, the future created by the async move block never actually yields because the inner future you await is always ready.

Rewrite empty wait as such:

async fn empty_await() -> i32 {
    tokio::task::yield_now().await;
    0
}

Many tokio async functions and futures use an internal budgeting system to force futures which would otherwise be ready to occasionally yield in order to mitigate this issue.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@galeaspablo
Comment options

@Noah-Kennedy
Comment options

Answer selected by Noah-Kennedy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants