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

Memory-Leak when hot-deploying without jackson modules

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical Critical
    • 33.0.0.Final
    • 22.0.0.Final
    • REST
    • None
    • Hide
      • Create a .war file with a jboss-deployment.xml file
        • add an Exclusion for jackson-dependencies within the jboss-deployment.xml file:
      <exclusions>
          <module name="com.fasterxml.jackson.core.jackson-core"/>
          <module name="com.fasterxml.jackson.core.jackson-databind"/>
          <module name="com.fasterxml.jackson.datatype.jackson-datatype-jdk8"/>
          <module name="com.fasterxml.jackson.datatype.jackson-datatype-jsr310"/>
          <module name="com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider"/>
          <module name="org.jboss.resteasy.resteasy-jackson2-provider"/>
      </exclusions> 
      • Hot-Deploy a few times
      • Take a heap dump from the running wildfly instance and see that the old module classloaders will not get garbage-collected
      • Deploy a few times more and get an OutOfMemoryError: Metaspace
      Show
      Create a .war file with a jboss-deployment.xml file add an Exclusion for jackson-dependencies within the jboss-deployment.xml file: <exclusions> <module name= "com.fasterxml.jackson.core.jackson-core" /> <module name= "com.fasterxml.jackson.core.jackson-databind" /> <module name= "com.fasterxml.jackson.datatype.jackson-datatype-jdk8" /> <module name= "com.fasterxml.jackson.datatype.jackson-datatype-jsr310" /> <module name= "com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider" /> <module name= "org.jboss.resteasy.resteasy-jackson2-provider" /> </exclusions> Hot-Deploy a few times Take a heap dump from the running wildfly instance and see that the old module classloaders will not get garbage-collected Deploy a few times more and get an OutOfMemoryError: Metaspace
    • ---
    • ---

      When excluding the jackson-dependencies from a .war file hot deployment will fail after a few times and Wildfly will hang with an OutOfMemoryError: Metaspace

      It seems that old ModuleClassLoaders are not garbage-collected because org.jboss.as.jaxrs.deployment.WildFlyConfigurationFactory still holds a reference to the module classloader.

      module unloading fails at this point in org.jboss.as.jaxrs.deployment.JaxrsIntegrationProcessor#undeploy:

      Class<?> typeFactoryClass = module.getClassLoader().loadClass("com.fasterxml.jackson.databind.type.TypeFactory");  // <-- this throws a ClassNotFoundException
      ...
      
      if (JaxrsDeploymentMarker.isJaxrsDeployment(context)) {
          WildFlyConfigurationFactory.getInstance().unregister(module.getClassLoader());   // <-- this never gets called
      }

      suggested fix would be to move the unregister(..) part out of the try/catch block.

              bstansbe@redhat.com Brian Stansberry
              kmhgdrn Kim Hagedorn (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: