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

(8.0.z) Memory leak in MetricCollector

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Blocker Blocker
    • 8.0.0.GA-CR2, 8.0.0.GA
    • 8.0.0.Beta-CR1
    • MP Metrics
    • None

      The MetricCollector#collectResourceMetrics() method registers a PropertyChangeListener:

      PropertyChangeListener listener = new PropertyChangeListener() {
                  @Override
                  public void propertyChange(PropertyChangeEvent evt) {
                      if (ControlledProcessState.State.RUNNING == evt.getNewValue()) {
                          registration.register();
                      } else if (ControlledProcessState.State.STOPPING == evt.getNewValue()) {
                          // Unregister so if this is a reload they won't still be around in a static cache in MetricsRegistry
                          // and cause problems when the server is starting
                          registration.unregister();
                          processStateNotifier.removePropertyChangeListener(this);
                      }
      
                  }
              };
              this.processStateNotifier.addPropertyChangeListener(listener);
      

      This listener is never removed when related DeploymentMetricService is stopped, leading to a memory leak - each application redeployment is creating additional instance of the listener and the MetricRegistration, which are never cleared.

      See JBEAP-25513 for reproduction steps.

              thofman Tomas Hofman
              thofman Tomas Hofman
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: