Skip to content

chore(rt): preserve executor caller locations#4066

Open
punkeel wants to merge 1 commit into
hyperium:masterfrom
punkeel:maxime/track-caller
Open

chore(rt): preserve executor caller locations#4066
punkeel wants to merge 1 commit into
hyperium:masterfrom
punkeel:maxime/track-caller

Conversation

@punkeel
Copy link
Copy Markdown

@punkeel punkeel commented May 10, 2026

Tokio task hooks report the source location of the tokio::spawn call. When runtime executor glue performs that spawn, the recorded location can point at the executor implementation itself. That is technically correct, but it hides the more useful callsite: the code path that asked the executor to create background work.

Mark Executor::execute and the HTTP/2 executor forwarding traits with track_caller so task instrumentation can attribute spawned tasks to the caller that requested execution rather than to generic executor forwarding glue.

Tokio task hooks report the source location of the tokio::spawn call.
When runtime executor glue performs that spawn, the recorded location can point
at the executor implementation itself. That is technically correct, but it
hides the more useful callsite: the code path that asked the executor to create
background work.

Mark Executor::execute and the HTTP/2 executor forwarding traits with
track_caller so task instrumentation can attribute spawned tasks to the caller
that requested execution rather than to generic executor forwarding glue.
@punkeel
Copy link
Copy Markdown
Author

punkeel commented May 10, 2026

related but independent: hyperium/hyper-util#283

@seanmonstar
Copy link
Copy Markdown
Member

Will this work? The executor gets turned into a dyn Executor, and the reference docs make it sound like the location data is decayed then: https://doc.rust-lang.org/stable/reference/attributes/codegen.html#r-attributes.codegen.track_caller.decay

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