Skip to content

Commit f99014d

Browse files
committed
try to fix pekko
1 parent 20dac8a commit f99014d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

dd-java-agent/instrumentation/pekko/pekko-http-1.0/src/main/java/datadog/trace/instrumentation/pekkohttp/DatadogServerRequestResponseFlowWrapper.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,19 @@ public void onUpstreamFailure(final Throwable ex) throws Exception {
146146
// Mark the span as failed
147147
AgentSpan span = fromContext(scope.context());
148148
DatadogWrapperHelper.finishSpan(span, ex);
149+
150+
// Clean up the leaked scope like in the normal response path
151+
AgentSpan activeSpan = activeSpan();
152+
if (activeSpan == span) {
153+
scope.close();
154+
}
149155
}
150156
// We will not receive any more responses from the user code, so clean up any
151157
// remaining spans
152158
scope = scopes.poll();
153159
while (scope != null) {
154160
fromContext(scope.context()).finish();
161+
scope.close();
155162
scope = scopes.poll();
156163
}
157164
fail(responseOutlet, ex);

0 commit comments

Comments
 (0)