Span in Kotlin `withTimeout` has wrong parent
@mcculls is already working on this.
Since Nov 19, 2025.
Assessment
This issue has not been assessed yet.
Description
Tracer Version(s)
1.54.0
Java Version(s)
21.0.7
JVM Vendor
Other (please specify in comments)
Bug Report
Hi! I have the following code in a Kotlin Ktor server application, when handling an incoming HTTP request:
post("/foo") {
span("withTimeoutOutside") {
delay(100)
withTimeout(500) {
span("withTimeoutInside") {
delay(100)
}
}
}
}
I'd expect the root span (for the HTTP request) to have a child of withTimeoutOutside, which has a child of withTimeoutInside. Instead, what I see is this:
This is possibly related to the fixes put in place for https://github.com/DataDog/dd-trace-java/issues/7215.
Let me know if you need me to provide anything else to help with this.
Thanks in advance!
(Am running on OpenJDK 64-Bit Server VM Temurin-21.0.7+6)
Expected Behavior
I'd expect the root span (for the HTTP request) to have a child of withTimeoutOutside, which has a child of withTimeoutInside.
Reproduction Code
No response
- Dominant language
- Java
- Stars
- 737
- Forks
- 361
- Avg merge
- 3d 20h
- Merged PRs (30d)
- 173
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from DataDog/dd-trace-java
-
type: feature request
Difficulty 1/5 1-3 hours Newbie friendliness 70/100
DataDog/dd-trace-java#10245 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 62/100
DataDog/dd-trace-java#12608 ·
-
type: bug report
Difficulty 4/5 3-5 days Newbie friendliness 35/100
DataDog/dd-trace-java#12597 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
DataDog/dd-trace-java#12540 · 3 comments · 1 assignee ·
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
DataDog/dd-trace-java#12480 ·
All issues in DataDog/dd-trace-java
Similar issues
-
certification
Difficulty 1/5 Under an hour Newbie friendliness 80/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
[BUG] ECR GetAuthorizationToken returns a proxyEndpoint for the default region, not the request's Openbug ecr
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Needs: Triage Type: Feature request
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
AntennaPod/AntennaPod#8794 ·
-
agentic-workflows
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
github/copilot-sdk#2760 ·