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 12:06:04 UTC

[GitHub] [skywalking] muyun12 opened a new issue #7001: jdk-threading-plugin cause a memory leak

muyun12 opened a new issue #7001:
URL: https://github.com/apache/skywalking/issues/7001


   Please answer these questions before submitting your issue.
   
   Why do you submit this issue?
   - [ ] Question or discussion
   - [x] Bug
   - [ ] Requirement
   - [ ] Feature or performance improvement
   
   ___
   ### Bug
   - CentOS 7.5
   - JRE 8
   - SkyWalking 6.5
   
   - 路歌
   
   - What happened?
   In the following scene, it will cause a memory leak:
   ```java
   	private static final ThreadPoolExecutor TPE = new ThreadPoolExecutor(4, 4,60 , TimeUnit.SECONDS, new ArrayBlockingQueue<>(1000));
   	public static void main(String[] args) {
   		// do something
   		TPE.execute(new Runnable() {
   			@Override
   			public void run() {
   				// do something
   			}
   		});
   		TPE.shutdown();
   		try {
   			TPE.awaitTermination(2, TimeUnit.HOURS);
   		} catch (InterruptedException e) {
   			// do something
   		}
   	}
   ```
   
   ThreadingMethodInterceptor class, as below:
   ```java
       @Override
       public void beforeMethod(final EnhancedInstance objInst, final Method method, final Object[] allArguments,
           final Class<?>[] argumentsTypes, final MethodInterceptResult result) {
           
           // this code cause a memory leak
           AbstractSpan span = ContextManager.createLocalSpan(generateOperationName(objInst, method));
           span.setComponent(ComponentsDefine.JDK_THREADING);
   
           final Object storedField = objInst.getSkyWalkingDynamicField();
           if (storedField != null) {
               final ContextSnapshot contextSnapshot = (ContextSnapshot) storedField;
               ContextManager.continued(contextSnapshot);
           }
   
       }
   ```
   
   ___
   


-- 
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



[GitHub] [skywalking] kezhenxu94 closed issue #7001: jdk-threading-plugin cause a memory leak

Posted by GitBox <gi...@apache.org>.
kezhenxu94 closed issue #7001:
URL: https://github.com/apache/skywalking/issues/7001


   


-- 
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