Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-21390

Memory Leak: ComponentConfiguration retained by ViewBindingConfigurator lambda in BinderService

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Blocker Blocker
    • 40.0.0.Beta1, 39.0.1.Final
    • 37.0.0.Final, 37.0.1.Final, 38.0.0.Final, 38.0.1.Final, 39.0.0.Final
    • EE
    • None

      *Environment:*
      WildFly 37 (migrating from WildFly 24)
      JDK 21

      *Description:*
      During migration of a large legacy EAR application (approx. 40 modules) from WildFly 24 to WildFly 37, we observed a significant increase in retained heap memory.

      Analysis of the Heap Dump using MAT revealed that `org.jboss.as.ee.component.ComponentConfiguration` instances (which should be deployment-time only) are not being garbage collected.

      *Root Cause Analysis:*
      The `ComponentConfiguration` is being captured by a Lambda expression inside `ViewBindingConfigurator`, which is held by `RemoteViewInjectionSource` within a `BinderService` in the MSC Service Container.

      Since the `BinderService` persists for the lifecycle of the application, the `ComponentConfiguration` is effectively leaked.

      *GC Root Path:*
      org.jboss.msc.service.ServiceContainerImpl
       └── registry
            └── table (ConcurrentHashMap)
                 └── node -> ServiceRegistrationImpl
                      └── service -> ServiceControllerImpl
                           └── value -> BinderService
                                └── source -> RemoteViewInjectionSource
                                     └── viewClassLoader -> ViewDescription$ViewBindingConfigurator$$Lambda
                                          └── arg$1 -> ComponentConfiguration 

       

       

      *Suggested Fix (from Zulip discussion):*
      Brian Stansberry noted that this can likely be fixed by pulling the `componentConfiguration.getModuleClassLoader()` call outside of the lambda in `ViewBindingConfigurator`.

              rhn-engineering-rhusar Radoslav Husar
              rhuanhianc Rhuan Hianc
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: