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

examples: Fix echo by Reintroducing Concurrency #1107

Merged
merged 1 commit into from
Nov 17, 2020

Conversation

davidbarsky
Copy link
Member

@davidbarsky davidbarsky commented Nov 15, 2020

In #808, I've added an .await? to an instrumented tokio::task::JoinHandle since the Instrument future now has a #[must_use]. However, this caused the echo example to no longer accept multiple netcat connections but was only reported in #1097. This PR resolves this bug by instrumenting the spawned future, not the JoinHandle.

More broadly, I think the interaction between tokio::task::JoinHandle (which does not have the #[must_use] annotation) and the tracing::Instrument future (which does have the #[must_use] annotation) is confusing and introduces performance footguns in refactors that even advanced users missed in code review.

Resolves #1097.

@davidbarsky davidbarsky requested a review from a team November 15, 2020 18:50
@davidbarsky davidbarsky merged commit 0d661b6 into master Nov 17, 2020
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.

example/echo.rs doesn't work concurrently
2 participants