Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-25618

(8.0.z) ISPN-15147 DefaultExecutorFactory can create multiple ThreadGroups

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical Critical
    • 8.0.0.GA-CR2, 8.0.0.GA
    • 7.4.12.GA, 8.0.0.GA-CR1
    • Clustering
    • None

      A new ThreadGroup is created each time the DefaultExecutorFactory#getExecutor() is called:

      https://github.com/infinispan/infinispan/blob/14.0.16.Final/core/src/main/java/org/infinispan/executors/DefaultExecutorFactory.java#L49

            if (blocking == null) {
               threadGroup = Thread.currentThread().getThreadGroup();
            } else {
               threadGroup = Boolean.parseBoolean(blocking) ? new BlockingThreadFactory.ISPNBlockingThreadGroup(threadNamePrefix + "-group") :
                     new NonBlockingThreadFactory.ISPNNonBlockingThreadGroup(threadNamePrefix + "-group");
            }
      ...
                Thread th = new Thread(threadGroup, r, threadName);
      

      The context of the memory leak is that during each application redeployment in Wildfly / EAP, a new instances of ISPNBlockingThreadGroup & ISPNNonBlockingThreadGroup plus some objects around those are created, and these are never cleared so they accumulate.

      See JBEAP-25513 for details on how to reproduce.

      Besides the fact that the ThreadGroup is never cleared up and introduces a memory leak, the group has always the same name, so it would perhaps be better to create it only once a then reuse this single instance?

      Alternatively the group could maybe be discarded at some point (not sure when)?

              thofman Tomas Hofman
              thofman Tomas Hofman
              Martin Choma Martin Choma
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: