You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2021/05/24 13:35:25 UTC

[GitHub] [skywalking] wu-sheng commented on a change in pull request #7003: fixed jdk-threading-plugin memory leak #7001

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



##########
File path: apm-sniffer/bootstrap-plugins/jdk-threading-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdk/threading/ThreadingMethodInterceptor.java
##########
@@ -34,11 +34,10 @@
     public void beforeMethod(final EnhancedInstance objInst, final Method method, final Object[] allArguments,
         final Class<?>[] argumentsTypes, final MethodInterceptResult result) {
 
-        AbstractSpan span = ContextManager.createLocalSpan(generateOperationName(objInst, method));
-        span.setComponent(ComponentsDefine.JDK_THREADING);
-
         final Object storedField = objInst.getSkyWalkingDynamicField();
         if (storedField != null) {
+            AbstractSpan span = ContextManager.createLocalSpan(generateOperationName(objInst, method));
+            span.setComponent(ComponentsDefine.JDK_THREADING);

Review comment:
       I am not sure this is the right fix. Why not remove `afterMethod`'s `ContextManager.stopSpan()`, as we are always creating local span in `beforeMethod`?




-- 
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:
users@infra.apache.org