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

Ensure tracing gets the correct spawning location for all spawn methods #5038

Open
hds opened this issue Sep 21, 2022 · 0 comments
Open

Ensure tracing gets the correct spawning location for all spawn methods #5038

hds opened this issue Sep 21, 2022 · 0 comments
Labels
A-tokio Area: The main tokio crate M-tracing Tracing support in Tokio

Comments

@hds
Copy link
Contributor

hds commented Sep 21, 2022

In the recently reported issue #5030 it was identified that tokio console lists a tokio internal location for all tasks created via spawn_local.

Console uses the (as yet unstable) tracing support in tokio to get a task locations via tokio::util::tracing::task. This functionality relies on the #[track_caller] feature.

One caveat of track caller is that it requires an unbroken chain of annotated functions from the calling site to tokio::util::tracing::task and it cannot pass through closures or async functions. This was the cause of the issue reported in #5030, the chain passed through a closure. In the fix for that issue (#5034), access to a thread local variable was refactored to avoid the call stack passing through the closure.

After a discussion on Discord, it seems like it would be good to verify the other cases.

We should go through all the different spawn functions to ensure that the original calling location is passed to tracing. Since ensuring that the call stack all the way up to tokio::util::tracing::task is correctly annotated isn't straight forward, tests should be added similar to those added as part of #4413 to prevent regressions.

The current locations that are calling tokio::util::tracing::task are:

These functions need to be traced back to all the public APIs that call them and those should be verified and tested.

@hds hds added A-tokio Area: The main tokio crate M-tracing Tracing support in Tokio labels Sep 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate M-tracing Tracing support in Tokio
Projects
None yet
Development

No branches or pull requests

1 participant