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

Failed deployment leaves classloader leaks through undertow references

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Minor
    • 27.0.0.Final
    • 27.0.0.Alpha1
    • Web (Undertow)
    • None
    • Hide

      1. Attempt to deploy the failedappleak.war some number of times for failed deployment attempts.
      2. Obtain a heap dump after and use an OQL like below to see the number of leaked classloaders that accumulated and can be traced to previously noted references:

      SELECT * FROM org.jboss.modules.ModuleClassLoader WHERE (module.name.value.toString() LIKE "deployment.failedappleak.war")
      
      Show
      1. Attempt to deploy the failedappleak.war some number of times for failed deployment attempts. 2. Obtain a heap dump after and use an OQL like below to see the number of leaked classloaders that accumulated and can be traced to previously noted references: SELECT * FROM org.jboss.modules.ModuleClassLoader WHERE (module.name.value.toString() LIKE "deployment.failedappleak.war" )
    • ---
    • ---

    Description

      If a deployment fails (such as an exception in a ServletContextListener.contextInitialized call), the contextDestroyed method is not invoked on listeners so anything depending on that for clean up is missed and leaves leaks. That means we miss clean up in https://github.com/wildfly/wildfly/blob/main/undertow/src/main/java/org/wildfly/extension/undertow/deployment/UndertowDeploymentInfoService.java#L960 and https://github.com/undertow-io/undertow/blob/master/websockets-jsr/src/main/java/io/undertow/websockets/jsr/Bootstrap.java#L132

      This leaves the classloader leaked from activities references in the SuspendController:

      Class Name                                                                                              | Ref. Objects | Shallow Heap | Ref. Shallow Heap | Retained Heap
      --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      value org.jboss.as.server.suspend.SuspendController @ 0x4c2130d20                                       |          550 |           48 |            48,400 |         3,496
      '- activities java.util.ArrayList @ 0x4c2130d68                                                         |          550 |           24 |            48,400 |         3,336
         '- elementData java.lang.Object[823] @ 0x56eda0df8                                                   |          550 |        3,312 |            48,400 |         3,312
            |- [148] org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$2 @ 0x579164a68  |            1 |           24 |                88 |            24
            |  '- this$0 org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService @ 0x51276a370|            1 |          176 |                88 |         2,424
            |     '- module org.jboss.modules.Module @ 0x51276a728                                            |            1 |           56 |                88 |       208,704
            |        '- moduleClassLoader org.jboss.modules.ModuleClassLoader @ 0x575161fb0                   |            1 |           88 |                88 |     1,224,776
      --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      

      And UndertowContainerProvider

      Class Name                                                                  | Ref. Objects | Shallow Heap | Ref. Shallow Heap | Retained Heap
      ----------------------------------------------------------------------------------------------------------------------------------------------
      [19] class io.undertow.websockets.jsr.UndertowContainerProvider @ 0xe2c84668|            5 |           24 |               480 |     2,121,200
      '- webSocketContainers java.util.concurrent.ConcurrentHashMap @ 0xe2c85048  |            5 |           64 |               480 |     2,120,840
         '- table java.util.concurrent.ConcurrentHashMap$Node[16] @ 0xe2c85088    |            5 |           80 |               480 |     2,120,776
            |- [14] java.util.concurrent.ConcurrentHashMap$Node @ 0xe2c850d8      |            2 |           32 |               192 |       848,032
            |  |- key org.jboss.modules.ModuleClassLoader @ 0xe2ac72f0            |            1 |           96 |                96 |         3,848
            |  |- next java.util.concurrent.ConcurrentHashMap$Node @ 0xe1c45918   |            1 |           32 |                96 |       424,200
            |  |  '- key org.jboss.modules.ModuleClassLoader @ 0xe2dd4400         |            1 |           96 |                96 |         3,904
      ----------------------------------------------------------------------------------------------------------------------------------------------
      

      Attachments

        Issue Links

          Activity

            People

              rhn-support-aogburn Aaron Ogburn
              rhn-support-aogburn Aaron Ogburn
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: