Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-10896

Memory Leak in AbstractBeanFactory, alreadyCreated HashSet not cleaned on failure in doGetBean

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: 3.2.4, 4.0 M3
    • Fix Version/s: 3.2.5, 4.0 RC1
    • Component/s: Core
    • Labels:
      None
    • Last commented by a User:
      true

      Description

      In the doGetMethod the bean name to alreadyCreated HashSet but if there is a failure in creation this entry is not removed leading to a leak.

      In our particular case the bean is a redirect with a name containing all of the unique parameters. getMergedLocalBeanDefinition, which is not in a try-catch block, throws a NoSuchBeanException therefore doGetBean throws without removing the entry from alreadyCreated.

      And it would appear that at no other failure point in the method is the entry removed from Already created.

      This has also be noted by CXF and worked around in their code (https://issues.apache.org/jira/browse/CXF-4795)

      Which also lead to the same local fix in Mule (https://github.com/mulesoft/mule/pull/21)

        Attachments

          Activity

            People

            Assignee:
            juergen.hoeller Juergen Hoeller
            Reporter:
            deviljelly Paul Anderson
            Last updater:
            Spring Issuemaster
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              1 year, 26 weeks, 1 day ago