typelevel / typelevel/cats-effect
Wrong stack trace with timeout
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 2.2k
- Forks
- 576
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 18
Description
Given the following code, I get a TimeoutException for 15000 millis that is right BUT the stack trace take me to the line of t2 instead of t3
I was expecting that the stack trace takes me to the timeout exceeded
val t1 = IO.sleep(1.seconds)
val t2 = IO.sleep(2.seconds).timeout(5.seconds)
val t3 = (t1 >> t2).timeout(1500.millis)
t3.unsafeRunSync() // TimeoutException at timeout Line 2
While if I add a timeout at t1 i get the same exception but the stack trace bring me to t1
val t1 = IO.sleep(1.seconds).timeout(5.seconds)
val t2 = IO.sleep(2.seconds).timeout(5.seconds)
val t3 = (t1 >> t2).timeout(1500.millis)
t3.unsafeRunSync() // TimeoutException at timeout Line 1
If there aren't nested timeout i get the right stack trace
val t1 = IO.sleep(1.seconds)
val t2 = IO.sleep(2.seconds)
val t3 = (t1 >> t2).timeout(1500.millis)
t3.unsafeRunSync() // TimeoutException at timeout Line 3
The issue persists with all cats.effect.tracing.mode mode
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.
Research direction
Reproduce the supplied Scala examples with nested and non-nested timeouts, checking the reported source location in each TimeoutException. Start by comparing behavior across the cats.effect.tracing.mode settings mentioned in the issue, then trace timeout handling until the outer timeout is identified. Done means the 1500-millisecond timeout points to the outer t3 timeout rather than t2 or t1.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100