wu-sheng commented on a change in pull request #6715:
URL: https://github.com/apache/skywalking/pull/6715#discussion_r610564498



##########
File path: 
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/ids/DistributedTraceIds.java
##########
@@ -37,6 +38,13 @@ public void append(DistributedTraceId distributedTraceId) {
         if (relatedGlobalTraces.size() > 0 && relatedGlobalTraces.getFirst() 
instanceof NewDistributedTraceId) {
             relatedGlobalTraces.removeFirst();
         }
+        /*
+         * There maybe an exception in some plugins, which causes the span to 
fail to exit,
+         * which results in the ThreadLocal not being cleaned up, and this 
data is increasing.
+         */
+        if (relatedGlobalTraces.size() >= 
Config.Agent.TRACE_SEGMENT_REF_LIMIT_PER_SEGMENT) {

Review comment:
       Check the codes of `getRelatedGlobalTraces`, it seems we need one 
reference here only?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to