1 Reply Latest reply on Apr 14, 2009 2:38 PM by Clebert Suconic

    Thread pools...

    Clebert Suconic Master

      During the process of looking for the QueueControl leak today, the profiler was indirectly showing lots references on RemotingConnectionImpl, going through two static fields, that are using some sort of thread pool:

      - InVMConnection::factory
      - ConnectionManagerImpl::pingExecutor


      The references were aways inside some method on a thread. Probably those references would be gone as soon as the pool is used, but it would be much easier to cleanup leaks if we aways recreate those pools on tearDowns(). (a simple kill -3 would show a cleaned memory if setting the dump-memory option on the VM)


      I was thinking about creating a method named recreatePingExecutor on ConnectionManagerImpl and another named recreateFactory on InVMConnection, and those methods would be marked to be used by tests only.

      Is there a problem on that approach?

        • 1. Re: Thread pools...
          Clebert Suconic Master

          Please, ignore this...


          I was seeing these references, when I was navigating through the memory using JVMTI. Those runnables were being executed at the same time the printReferences was called. If I waited 5 seconds to print the references, all of this went away.

          <br>!--!-- FieldReference final java.lang.Runnable java.util.concurrent.Executors$RunnableAdapter.task=OBJ(java.util.concurrent.Executors$RunnableAdapter@884010469)
          <br>!--!--!-- FieldReference private final java.util.concurrent.Callable java.util.concurrent.FutureTask$Sync.callable=OBJ(java.util.concurrent.FutureTask$Sync@1691493474)
          <br>!--!--!--!-- FieldReference private final java.util.concurrent.FutureTask$Sync java.util.concurrent.FutureTask.sync=OBJ(java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@490829456)
          <br>!--!--!--!--!-- arrayRef [Ljava.lang.Object;[6] id=@885978865
          <br>!--!--!--!--!--!-- FieldReference private transient java.lang.Object[] java.util.PriorityQueue.queue=OBJ(java.util.PriorityQueue@1602698930)
          <br>!--!--!--!--!--!--!-- FieldReference private final java.util.PriorityQueue java.util.concurrent.DelayQueue.q=OBJ(java.util.concurrent.DelayQueue@673532189)
          <br>!--!--!--!--!--!--!--!-- Reference inside a method - java.util.concurrent.DelayQueue::take
          <br>!--!--!--!--!--!--!--!-- Reference inside a method - java.util.concurrent.DelayQueue::take
          <br>!--!--!--!--!--!--!--!-- Reference inside a method - java.util.concurrent.DelayQueue::take
          <br>!--!--!--!--!--!--!--!-- Reference inside a method - java.util.concurrent.DelayQueue::take
          <br>!--!--!--!--!--!--!--!-- Reference inside a method - java.util.concurrent.DelayQueue::take
          <br>!--!--!--!--!--!--!--!-- FieldReference private final java.util.concurrent.DelayQueue java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.dq=OBJ(java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue@669197186)
          <br>!--!--!--!--!--!--!--!--!-- Reference inside a method - java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue::take
          <br>!--!--!--!--!--!--!--!--!-- Reference inside a method - java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue::take
          <br>!--!--!--!--!--!--!--!--!-- Reference inside a method - java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue::take
          <br>!--!--!--!--!--!--!--!--!-- Reference inside a method - java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue::take
          <br>!--!--!--!--!--!--!--!--!-- Reference inside a method - java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue::take
          <br>!--!--!--!--!--!--!--!--!-- Reference inside a method - java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue::take
          <br>!--!--!--!--!--!--!--!--!-- Reference inside a method - java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue::take
          <br>!--!--!--!--!--!--!--!--!-- Reference inside a method - java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue::take
          <br>!--!--!--!--!--!--!--!--!-- Reference inside a method - java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue::take
          <br>!--!--!--!--!--!--!--!--!-- Reference inside a method - java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue::take
          <br>!--!--!--!--!--!--!--!--!-- FieldReference private final java.util.concurrent.BlockingQueue java.util.concurrent.ThreadPoolExecutor.workQueue=OBJ(java.util.concurrent.ScheduledThreadPoolExecutor@1456146415)
          <br>!--!--!--!--!--!--!--!--!--!-- Reference inside a method - java.util.concurrent.ThreadPoolExecutor::getTask
          <br>!--!--!--!--!--!--!--!--!--!-- Reference inside a method - java.util.concurrent.ThreadPoolExecutor::getTask
          <br>!--!--!--!--!--!--!--!--!--!-- Reference inside a method - java.util.concurrent.ThreadPoolExecutor::getTask
          <br>!--!--!--!--!--!--!--!--!--!-- Reference inside a method - java.util.concurrent.ThreadPoolExecutor::getTask
          <br>!--!--!--!--!--!--!--!--!--!-- Reference inside a method - java.util.concurrent.ThreadPoolExecutor::getTask
          <br>!--!--!--!--!--!--!--!--!--!-- StaticFieldReference private static java.util.concurrent.ScheduledThreadPoolExecutor org.jboss.messaging.core.client.impl.ConnectionManagerImpl.pingExecutor
          <br>!--!--!--!--!--!--!--!--!--!-- FieldReference final java.util.concurrent.ThreadPoolExecutor java.util.concurrent.ThreadPoolExecutor$Worker.this$0=OBJ(java.util.concurrent.ThreadPoolExecutor$Worker@431709193)
          <br>!--!--!--!--!--!--!--!--!--!--!--<b>MaxLevel</b>
          <br>!--!--!--!--!--!--!--!--!--!-- FieldReference final java.util.concurrent.ThreadPoolExecutor java.util.concurrent.ThreadPoolExecutor$Worker.this$0=OBJ(java.util.concurrent.ThreadPoolExecutor$Worker@1871151428)
          <br>!--!--!--!--!--!--!--!--!--!--!--<b>MaxLevel</b>
          <br>!--!--!--!--!--!--!--!--!--!-- FieldReference final java.util.concurrent.ThreadPoolExecutor java.util.concurrent.ThreadPoolExecutor$Worker.this$0=OBJ(java.util.concurrent.ThreadPoolExecutor$Worker@1155557696)
          <br>!--!--!--!--!--!--!--!--!--!--!--<b>MaxLevel</b>
          <br>!--!--!--!--!--!--!--!--!--!-- FieldReference final java.util.concurrent.ThreadPoolExecutor java.util.concurrent.ThreadPoolExecutor$Worker.this$0=OBJ(java.util.concurrent.ThreadPoolExecutor$Worker@1608577782)
          <br>!--!--!--!--!--!--!--!--!--!--!--<b>MaxLevel</b>
          <br>!--!--!--!--!--!--!--!--!--!-- FieldReference final java.util.concurrent.ThreadPoolExecutor java.util.concurrent.ThreadPoolExecutor$Worker.this$0=OBJ(java.util.concurrent.ThreadPoolExecutor$Worker@1567434291)
          <br>!--!--!--!--!--!--!--!--!--!--!--<b>MaxLevel</b>
          <br>!--!--!--!--!--!--!--!--!--!-- FieldReference final java.util.concurrent.ScheduledThreadPoolExecutor java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.this$0=OBJ(java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@729155693)
          <br>!--!--!--!--!--!--!--!--!--!--!--<b>MaxLevel</b>
          <br>!--!--!--!--!--!--!--!--!--!-- FieldReference private final java.util.concurrent.ScheduledExecutorService org.jboss.messaging.core.remoting.impl.RemotingConnectionImpl.pingExecutor=OBJ(org.jboss.messaging.core.remoting.impl.RemotingConnectionImpl@148643588)
          <br>!--!--!--!--!--!--!--!--!--!--!--<b>MaxLevel</b>
          <br>!--!--!--!--!--!--!--!--!--!-- FieldReference final java.util.concurrent.ScheduledThreadPoolExecutor java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.this$0=OBJ(java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@490829456)
          <br>!--!--!--!--!--!--!--!--!--!--!--<b>MaxLevel</b>
          <br>!--!--!--!--!--!--!--!--!--!-- FieldReference private final java.util.concurrent.ScheduledExecutorService org.jboss.messaging.core.remoting.impl.RemotingConnectionImpl.pingExecutor=OBJ(org.jboss.messaging.core.remoting.impl.RemotingConnectionImpl@1278255007)
          <br>!--!--!--!--!--!--!--!--!--!--!--<b>MaxLevel</b>
          <br>!--!--!--!--!--!--!--!--!--!-- FieldReference final java.util.concurrent.ScheduledThreadPoolExecutor java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.this$0=OBJ(java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@729302055)
          <br>!--!--!--!--!--!--!--!--!--!--!--<b>MaxLevel</b>
          <br>!--!--!--!--!--!--!--!--!--!-- FieldReference private final java.util.concurrent.ScheduledExecutorService org.jboss.messaging.core.remoting.impl.RemotingConnectionImpl.pingExecutor=OBJ(org.jboss.messaging.core.remoting.impl.RemotingConnectionImpl@1690464956)
          <br>!--!--!--!--!--!--!--!--!--!--!--<b>MaxLevel</b>
          <br>!--!--!--!--!--!--!--!--!--!-- FieldReference final java.util.concurrent.ScheduledThreadPoolExecutor java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.this$0=OBJ(java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@435865682)
          <br>!--!--!--!--!--!--!--!--!--!--!--<b>MaxLevel</b>
          <br>!--!--!--!--!--!--!--!--!--!-- FieldReference private final java.util.concurrent.ScheduledExecutorService org.jboss.messaging.core.remoting.impl.RemotingConnectionImpl.pingExecutor=OBJ(org.jboss.messaging.core.remoting.impl.RemotingConnectionImpl@527797457)
          <br>!--!--!--!--!--!--!--!--!--!--!--<b>MaxLevel</b>
          <br>!--!--!--!--!--!--!--!--!--!-- FieldReference final java.util.concurrent.ScheduledThreadPoolExecutor java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.this$0=OBJ(java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@1584397689)
          <br>!--!--!--!--!--!--!--!--!--!--!--<b>MaxLevel</b>
          <br>!--!--!--!--!--!--!--!--!--!-- FieldReference private final java.util.concurrent.ScheduledExecutorService org.jboss.messaging.core.remoting.impl.RemotingConnectionImpl.pingExecutor=OBJ(org.jboss.messaging.core.remoting.impl.RemotingConnectionImpl@174736223)
          <br>!--!--!--!--!--!--!--!--!--!--!--<b>MaxLevel</b>
          <br>!--!--!--!--!--!--!--!--!--!-- FieldReference final java.util.concurrent.ScheduledThreadPoolExecutor java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.this$0=OBJ(java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@1181554512)
          <br>!--!--!--!--!--!--!--!--!--!--!--<b>MaxLevel</b>
          <br>!--!--!--!--!--!--!--!--!--!-- FieldReference private final java.util.concurrent.ScheduledExecutorService org.jboss.messaging.core.remoting.impl.RemotingConnectionImpl.pingExecutor=OBJ(org.jboss.messaging.core.remoting.impl.RemotingConnectionImpl@605399375)
          <br>!--!--!--!--!--!--!--!--!--!--!--<b>MaxLevel</b>
          <br>!--!--!--!--!--!--!--!--!--!-- FieldReference final java.util.concurrent.ScheduledThreadPoolExecutor java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.this$0=OBJ(java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@169776139)
          <br>!--!--!--!--!--!--!--!--!--!--!--<b>MaxLevel</b>
          <br>!--!--!--!--!--!--!--!--!--!-- FieldReference private final java.util.concurrent.ScheduledExecutorService org.jboss.messaging.core.remoting.impl.RemotingConnectionImpl.pingExecutor=OBJ(org.jboss.messaging.core.remoting.impl.RemotingConnectionImpl@1569284957)
          <br>!--!--!--!--!--!--!--!--!--!--!--<b>MaxLevel</b>
          <br>!--!--!--!--!--!--!--!--!--!-- FieldReference final java.util.concurrent.ScheduledThreadPoolExecutor java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.this$0=OBJ(java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@1725603492)
          <br>!--!--!--!--!--!--!--!--!--!--!--<b>MaxLevel</b>
          <br>!--!--!--!--!--!--!--!--!--!-- FieldReference private final java.util.concurrent.ScheduledExecutorService org.jboss.messaging.core.remoting.impl.RemotingConnectionImpl.pingExecutor=OBJ(org.jboss.messaging.core.remoting.impl.RemotingConnectionImpl@451237309)
          <br>!--!--!--!--!--!--!--!--!--!--!--<b>MaxLevel</b>
          <br>!--!--!--!--!--!--!--!--!--!-- FieldReference private java.lang.Object java.lang.ref.Reference.referent=OBJ(java.lang.ref.Finalizer@1188706162)
          <br>!--!--!--!--!--!--!--!--!--!--!--<b>MaxLevel</b>
          <br>!--!--!--!--!-- FieldReference final java.util.concurrent.FutureTask java.util.concurrent.FutureTask$Sync.this$0=OBJ(java.util.concurrent.FutureTask$Sync@1691493474)
          <br>!--!--!--!--!--!-- object instanceOf class java.util.concurrent.FutureTask$Sync@1691493474 was already described before on this report
          <br>!--!--!--!--!-- FieldReference private java.util.concurrent.ScheduledFuture org.jboss.messaging.core.remoting.impl.RemotingConnectionImpl.future=OB
          ...