Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.5
    • Fix Version/s: 2.0.7, 2.1 M3
    • Component/s: Core:AOP
    • Labels:
      None
    • Last commented by a User:
      false

      Description

      We are seeing a memory leak in ProxyFactory when using cglib. I will attach a picture of the references.

      1. cglib.patch
        7 kB
        Andy Piper
      2. cglib.patch
        6 kB
        Andy Piper
      1. snap_cglib.jpg
        190 kB

        Issue Links

          Activity

          Hide
          andypiper Andy Piper added a comment -

          Memory reference picture

          Show
          andypiper Andy Piper added a comment - Memory reference picture
          Hide
          andypiper Andy Piper added a comment -

          I think that the bug is in ProxyCallbackFilter. cglib maintains a hard reference to this in the key and so the value doesn't go away. I suspect by making the fixedInterceptorMap and advised fields weak this may cure the problem.

          Show
          andypiper Andy Piper added a comment - I think that the bug is in ProxyCallbackFilter. cglib maintains a hard reference to this in the key and so the value doesn't go away. I suspect by making the fixedInterceptorMap and advised fields weak this may cure the problem.
          Hide
          juergen.hoeller Juergen Hoeller added a comment -

          This might be a general memory leak problem with CGLIB, I'm afraid. If we make Spring's fields weakly referenced there, the CGLIB class itself will probably still stay around in memory. Of course the leak would show less effect then... so that might already help.

          Juergen

          Show
          juergen.hoeller Juergen Hoeller added a comment - This might be a general memory leak problem with CGLIB, I'm afraid. If we make Spring's fields weakly referenced there, the CGLIB class itself will probably still stay around in memory. Of course the leak would show less effect then... so that might already help. Juergen
          Hide
          andypiper Andy Piper added a comment -

          I'm not so sure. cglib correctly uses a WeakHashMap, with Spring fixed things might be ok. I'll attach the candidate fix that I am testing.

          Show
          andypiper Andy Piper added a comment - I'm not so sure. cglib correctly uses a WeakHashMap, with Spring fixed things might be ok. I'll attach the candidate fix that I am testing.
          Hide
          andypiper Andy Piper added a comment -

          Candidate fix

          Show
          andypiper Andy Piper added a comment - Candidate fix
          Hide
          andypiper Andy Piper added a comment -

          This is confirmed to fix at least one leak.

          Show
          andypiper Andy Piper added a comment - This is confirmed to fix at least one leak.
          Hide
          andypiper Andy Piper added a comment -

          Updated patch. I found another leak.

          Show
          andypiper Andy Piper added a comment - Updated patch. I found another leak.
          Hide
          juergen.hoeller Juergen Hoeller added a comment -

          I have fixed this in CVS HEAD (for 2.1 M3) and mbranch-2-0 (for 2.0.7). This should be available in the next 2.1 M3 as well as 2.0.7 snapshots (tonight / tomorrow).

          Juergen

          Show
          juergen.hoeller Juergen Hoeller added a comment - I have fixed this in CVS HEAD (for 2.1 M3) and mbranch-2-0 (for 2.0.7). This should be available in the next 2.1 M3 as well as 2.0.7 snapshots (tonight / tomorrow). Juergen
          Hide
          juergen.hoeller Juergen Hoeller added a comment -

          Andy, could you please re-test a current 2.5 RC2 / 2.0.8 snapshot with respect to this leak? I had to revise Cglib2AopProxy again since the fixes that you suggested here unfortunately caused a side effect with the reuse of CGLIB proxy classes... (see SPR-4004)

          Thanks in advance,

          Juergen

          Show
          juergen.hoeller Juergen Hoeller added a comment - Andy, could you please re-test a current 2.5 RC2 / 2.0.8 snapshot with respect to this leak? I had to revise Cglib2AopProxy again since the fixes that you suggested here unfortunately caused a side effect with the reuse of CGLIB proxy classes... (see SPR-4004 ) Thanks in advance, Juergen

            People

            • Assignee:
              juergen.hoeller Juergen Hoeller
              Reporter:
              andypiper Andy Piper
              Last updater:
              Trevor Marshall
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                9 years, 38 weeks, 1 day ago