JDK-6949855 : OutOfMemory on JDK 1.6.0_18, 1.6.0_19 and 1.6.0_20, suspected java.util.logging
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util.logging
  • Affected Version: 6u20
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2010-05-05
  • Updated: 2011-02-16
  • Resolved: 2010-05-10
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.6.0_19"
Java(TM) SE Runtime Environment (build 1.6.0_19-b04)
Java HotSpot(TM) Client VM (build 16.2-b04, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
Since we upgraded to JDK 1.6.0_19 we are experiencing OutOfMemory exceptions. Reverting back to JDK 1.6.0_11 solves these.

Doing a Google search yielded many others having problems. Specifically this page is interesting:
http://stackoverflow.com/questions/2497720/memory-leak-of-java-lang-ref-weakreference-objects-inside-jdk-classes

It has a very small sample app that reproduces this problem on JDK versions 1.6.0_18, 1.6.0_19 and 1.6.0_20. See Source code for an executable test case.

The problem cannot be reproduced on 1.6.0_17, according to one of the comments there. I have not tried that myself.


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the sample application with these java arguments:
-Xms8m -Xmx8m -XX:MaxPermSize=8m
After 10 - 15 minutes it will produce an OutOfMemoryError.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No OutOfMemoryError should occur.
ACTUAL -
>time
The current time is: 15:03:39,07

>java.exe -Xms8m -Xmx8m -XX:MaxPermSize=8m FillHeap
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
        at java.util.Arrays.copyOf(Arrays.java:2760)
        at java.util.Arrays.copyOf(Arrays.java:2734)
        at java.util.ArrayList.ensureCapacity(ArrayList.java:167)
        at java.util.ArrayList.add(ArrayList.java:351)
        at java.util.logging.Logger.doSetParent(Logger.java:1385)
        at java.util.logging.Logger.getAnonymousLogger(Logger.java:346)
        at FillHeap.main(FillHeap.java:21)

>time
The current time is: 15:17:14,55

(It took actually a bit less time but I took some time myself before I noticed that it was 'done' already)

ERROR MESSAGES/STACK TRACES THAT OCCUR :
RESULTS of consecutive jmap command invocations:

>time
The current time is: 14:51:01,22

>jmap -histo 2920

 num     #instances         #bytes  class name
----------------------------------------------
   1:         28948        1852672  java.util.logging.Logger
   2:         28954         694896  java.lang.ref.WeakReference

>time
The current time is: 14:51:08,78

>jmap -histo 2920

 num     #instances         #bytes  class name
----------------------------------------------
   1:         31854        2038656  java.util.logging.Logger
   2:         31860         764640  java.lang.ref.WeakReference

>time
The current time is: 14:51:13,79

>jmap -histo 2920

 num     #instances         #bytes  class name
----------------------------------------------
   1:         34089        2181696  java.util.logging.Logger
   2:         34095         818280  java.lang.ref.WeakReference

>time
The current time is: 14:51:41,92

>jmap -histo 2920

 num     #instances         #bytes  class name
----------------------------------------------
   1:         37420        2394880  java.util.logging.Logger
   2:         48704        1168896  java.lang.ref.WeakReference

>time
The current time is: 14:51:46,55

>jmap -histo 2920

 num     #instances         #bytes  class name
----------------------------------------------
   1:         40480        2590720  java.util.logging.Logger
   2:         51764        1242336  java.lang.ref.WeakReference

>time
The current time is: 14:51:53,47

>jmap -histo 2920

 num     #instances         #bytes  class name
----------------------------------------------
   1:         45434        2907776  java.util.logging.Logger
   2:         56718        1361232  java.lang.ref.WeakReference

>time
The current time is: 14:52:24,44

>jmap -histo 2920

 num     #instances         #bytes  class name
----------------------------------------------
   1:         59179        3787456  java.util.logging.Logger
   2:         70463        1691112  java.lang.ref.WeakReference

>time
The current time is: 14:52:29,38

>jmap -histo 2920

 num     #instances         #bytes  class name
----------------------------------------------
   1:         61119        3911616  java.util.logging.Logger
   2:         72403        1737672  java.lang.ref.WeakReference

>time
The current time is: 14:52:32,55

>jmap -histo 2920

 num     #instances         #bytes  class name
----------------------------------------------
   1:         63794        4082816  java.util.logging.Logger
   2:         75078        1801872  java.lang.ref.WeakReference

>time
The current time is: 14:52:59,13

>jmap -histo 2920

 num     #instances         #bytes  class name
----------------------------------------------
   1:         70875        4536000  java.util.logging.Logger
   2:         88639        2127336  java.lang.ref.WeakReference

>time
The current time is: 14:53:04,97

>jmap -histo 2920

 num     #instances         #bytes  class name
----------------------------------------------
   1:         73063        4676032  java.util.logging.Logger
   2:         90827        2179848  java.lang.ref.WeakReference

>time
The current time is: 14:53:08,66

>jmap -histo 2920

 num     #instances         #bytes  class name
----------------------------------------------
   1:         76206        4877184  java.util.logging.Logger
   2:         93970        2255280  java.lang.ref.WeakReference

>time
The current time is: 14:53:34,41

>jmap -histo 2920

 num     #instances         #bytes  class name
----------------------------------------------
   1:         88078        5636992  java.util.logging.Logger
   2:        105842        2540208  java.lang.ref.WeakReference

>time
The current time is: 14:53:38,97

>jmap -histo 2920

 num     #instances         #bytes  class name
----------------------------------------------
   1:         90672        5803008  java.util.logging.Logger
   2:        108436        2602464  java.lang.ref.WeakReference

>time
The current time is: 14:53:43,85

>jmap -histo 2920

 num     #instances         #bytes  class name
----------------------------------------------
   1:         94031        6017984  java.util.logging.Logger
   2:        111795        2683080  java.lang.ref.WeakReference


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
public class FillHeap
{
  /**
   * Abuses an error in JVM 1.6.0_18, 1.6.0_19 or 1.6.0_20 to force an OutOfMemoryError.
   *
   * @param args none
   *
   * @throws java.lang.OutOfMemoryError: Java heap space
   */
  public static void main(String[] args) throws Exception
  {
    while (true)
    {
      java.util.logging.Logger.getAnonymousLogger();
      Thread.sleep(1);
    }
  }
}

---------- END SOURCE ----------

Release Regression From : 6u17
The above release value was the last known release where this 
bug was not reproducible. Since then there has been a regression.

Comments
EVALUATION E-mail from Nelson: On 5/10/2010 8:33 AM, Nelson wrote: > Daniel, > > Yes, going over the two reports - I would say that we can close 6949855 as a duplicate of 6942989 . However I would suggest adding the regression keyword for 6942989 as this problem does not manifest in JDK 1.6.0_11. > > Thanks, > Nelson
10-05-2010

EVALUATION This looks like a duplicate of the following bug: 6942989 2/2 Memory leak of java.lang.ref.WeakReference objects I'll double check with the submitter before closing this one as a dup.
05-05-2010