Commons Lang
  1. Commons Lang
  2. LANG-586

Use of ThreadLocals in ToStringStyle and HashCodeBuilder trigger memory leaks in container environments

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.5
    • Component/s: lang.builder.*
    • Labels:
      None

      Description

      The thread local in org.apache.commons.lang3.builder.ToStringStyle is created but never removed and no API is provided to remove it. If a webapp's use of LANG triggers the loading of this class, a reference chain will be created that will cause a memory leak on web application reload.

      See http://markmail.org/thread/uetw2fdrsqgbh2cv for more info.

        Activity

        Hide
        Matt Benson added a comment -

        As it happens I'm currently working on similar issues at $work and just removed a ThreadLocal from the [flatfile] component; I'll take a look.

        Show
        Matt Benson added a comment - As it happens I'm currently working on similar issues at $work and just removed a ThreadLocal from the [flatfile] component; I'll take a look.
        Hide
        Matt Benson added a comment -

        svn commit: r906673
        svn commit: r906676

        Show
        Matt Benson added a comment - svn commit: r906673 svn commit: r906676
        Hide
        Mark Thomas added a comment -

        Thanks for such a quick response.

        Show
        Mark Thomas added a comment - Thanks for such a quick response.
        Hide
        Matt Benson added a comment -

        merged for [lang] 2.5 r907129

        Show
        Matt Benson added a comment - merged for [lang] 2.5 r907129
        Hide
        Matt Benson added a comment -

        HashCodeBuilder fixed for 3.0 r907373

        Show
        Matt Benson added a comment - HashCodeBuilder fixed for 3.0 r907373

          People

          • Assignee:
            Unassigned
            Reporter:
            Mark Thomas
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development