Skip navigation
Currently Being Moderated

Memory leak found - coldfusion.util.key

Feb 22, 2012 1:11 AM

Tags: #memory_leak #cf10

Hey All,

 

I found this memory leak in CF9.01 and have confirmed it still exists in CF10. 

 

To reproduce, create two .cfm files & hit them in an Apache JMeter test with two threads.  I'm using a brand new install of CF10 with inbuilt web server.  MemoryLeak.cfm will not acheive 100 requests (GC overhead limit exceeded), where as my NoMemoryLeak.cfm test is up to 500,000 tests and still going without the old gen increasing at all.

 

Obviously this is not real production code, but on a very large OO app that also uses lots of structs the test server needs rebooting every 2 weeks due to same problem.  We are on CF8 at the moment and want to spend AU$50,000 on a 9.01 upgrade with maintenance for a 10.0 upgrade but can't move because of this memory leak. 

 


-- MemoryLeak.cfm

 

<cfset transient = structNew() />

<cfset base = getTickCount() />

<cfloop from="1" to="10000" index="index">

<cfset transient[hash("#base##index#")] = true >

</cfloop>

<cfoutput>

Done

</cfoutput>

 

 

 

-- NoMemoryLeak.cfm

<cfset transient = structNew() />

<cfloop from="1" to="10000" index="index">

<cfset transient[hash("#index#")] = true >

</cfloop>

<cfoutput>

Done

</cfoutput>

 
Replies
  • Currently Being Moderated
    Feb 22, 2012 6:56 AM   in reply to Davo112233

    Thanks for reporting this issue. Can you please log a bug in the bugtracker? This will help us track and investigate the issue.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 22, 2012 11:32 AM   in reply to hemant_k

    No worries.  Logged as Bug #3120864 for CF10.  - I logged similar bug for CF9.01 yesterday as #3119991  - the test casees for #3120864 make it easer to see the acutal bug.

     

    Thanks,

    Dave


     
    |
    Mark as:
  • Currently Being Moderated
    Feb 22, 2012 5:27 PM   in reply to davidames

    +1

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 23, 2012 2:42 PM   in reply to hemant_k

    Is there a way we can speed up getting a fix for this issue, even in CF9.01?  Would a paid support incident help?  Or can we pay for a fix for this issue?  This is a big problem for us. 

     

    Thanks,

    Dave

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 23, 2012 3:35 PM   in reply to davidames

    Yes, I would recommend you to go through the support for this.

     

    Sent from my HTC

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 23, 2012 5:04 PM   in reply to rupesh_kumar

    Will do. In the mean-time,

     

     

    A colleague  came up with a solution that involves sub-classing the ColdFusion.Util.Key class and calling keys.clear() We plan to do this via a scheduled task every night.  Do you see any obvious problems with this approach?

     

     

    Field f = Key.class.getDeclaredField("keys");
                f
    .setAccessible(true);
               
    ConcurrentHashMap chm = (ConcurrentHashMap)f.get(k);
                chm
    .clear();


    See: http://stackoverflow.com/questions/5898291/coldfusion-util-key-memory- leak-issue-with-structure-keys/9401913  for the full post/details

    dave

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 28, 2012 9:48 PM   in reply to davidames

    Hi Dave,

     

    I see the CF10 bugbase has issue withdrawn. CF9 bugbase has fixed. Is there a hotfix for this to download and try on CF9 and CF10?

     

    Cheers, Carl.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 28, 2012 9:53 PM   in reply to carl type3

    Carl,

    I would request you to go through the support to request a hotfix for this.

     

    Thanks & Regards,

    Rupesh

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points