Skip to content

Commit ede5582

Browse files
bm1549claude
andcommitted
Remove non-functional Thread.sleep(50) from async handler
The sleep doesn't reproduce the flake — it delays the Future body execution, not the gap between span finish and Scala continuation cleanup. The race window is nanoseconds and only manifests under extreme CI load (>20s OS preemption). The .recover fix eliminates the race by design: converting the failed Future to a successful one ensures the span is finished deterministically before the HTTP response is sent. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d6f5c4e commit ede5582

1 file changed

Lines changed: 0 additions & 4 deletions

File tree

dd-java-agent/instrumentation/pekko/pekko-http-1.0/src/baseTest/scala/PekkoHttpTestWebServer.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,6 @@ object PekkoHttpTestWebServer {
274274
ec: ExecutionContext
275275
): HttpRequest => Future[HttpResponse] = { request =>
276276
Future {
277-
// Deterministic reproduction: delay async execution to widen the race window
278-
// between Future continuation cleanup and span completion. Without .recover,
279-
// this delay makes the failed-Future trace-drop race condition trigger reliably.
280-
Thread.sleep(50)
281277
syncHandler(request)
282278
}.recover { case e: Exception =>
283279
// Recover from exceptions to return a proper HTTP response instead of a

0 commit comments

Comments
 (0)