Skip to content

Commit d6f5c4e

Browse files
bm1549claude
andcommitted
Add artificial delay for deterministic race condition reproduction
Add Thread.sleep(50) inside the async handler's Future to widen the race window between Future continuation cleanup and span completion. Without the .recover fix, this delay causes the failed-Future trace-drop to trigger reliably. With .recover, the delay is harmless because the Future always succeeds. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c5a177c commit d6f5c4e

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,10 @@ 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)
277281
syncHandler(request)
278282
}.recover { case e: Exception =>
279283
// Recover from exceptions to return a proper HTTP response instead of a

0 commit comments

Comments
 (0)