diff --git a/CHANGES.md b/CHANGES.md index d8d5f5d21..79e593ca8 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -17,6 +17,7 @@ Release Notes. * Add dubbo 3.x plugin. * Fix TracePathMatcher should match pattern "**" with paths end by "/" * Add support `returnedObj` expression for apm-customize-enhance-plugin +* Fix the bug that httpasyncclient-4.x-plugin puts the dirty tracing context in the connection context #### Documentation diff --git a/apm-sniffer/apm-sdk-plugin/httpasyncclient-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/httpasyncclient/v4/LeaseRequestCompletedInterceptor.java b/apm-sniffer/apm-sdk-plugin/httpasyncclient-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/httpasyncclient/v4/LeaseRequestCompletedInterceptor.java index 61dd2df4e..76d6ad04a 100644 --- a/apm-sniffer/apm-sdk-plugin/httpasyncclient-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/httpasyncclient/v4/LeaseRequestCompletedInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/httpasyncclient-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/httpasyncclient/v4/LeaseRequestCompletedInterceptor.java @@ -33,7 +33,7 @@ public class LeaseRequestCompletedInterceptor implements InstanceMethodsAroundIn MethodInterceptResult result) throws Throwable { PoolEntry entry = (PoolEntry) allArguments[0]; NHttpConnection conn = (NHttpConnection) entry.getConnection(); - if (ContextManager.isActive()) { + if (ContextManager.isActive() && !ContextManager.activeSpan().isExit()) { conn.getContext().setAttribute(Constants.SKYWALKING_CONTEXT_SNAPSHOT, ContextManager.capture()); conn.getContext().setAttribute(Constants.SKYWALKING_HTTP_CONTEXT, Constants.HTTP_CONTEXT_LOCAL.get()); }