Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4099343

printStackTrace() call after OutOfMemoryError crashes VM

    Details

    • Subcomponent:
    • Resolved In Build:
      1.2beta3
    • CPU:
      sparc
    • OS:
      solaris_2.5.1
    • Verification:
      Verified

      Description



      Name: icC57033 Date: 12/15/97


      Next program Crasher.java crashes JVM
      when called with limited Java heap sizes: -ms1m -mx1m.

      Those crashing is reproduceable for release
      1.2S, 1.2V, 1.2W, 1.2X, 1.2Z
      But can't be reproduced for 1.1.4, 1.1.5, 1.2P
        
      ------------------ Crasher.java --------------------
      public class Crasher {
        Crasher eat[];
        
        Crasher(Crasher prev,int len) {
          eat=new Crasher[len];
          if( prev!=null ) prev.eat[0]=this;
        }
        
        public static void main(String argv[]) {
          Crasher first,last;
          int len=(new Integer("10")).intValue(); // needed for fastest crash !!
                                                  // len must equal ~10 !!
      for( ; ; ){
            try {
              first = new Crasher(null,len);
              last=first;
              for( ; ; ){
               last = new Crasher(last,len);
              }
            }
            catch (Throwable e) {
              first = last = null;
      try {
                e.printStackTrace();
              }
              catch (Throwable ee) {
              }
            }
          }
        }
      }
      -----------------------------------------------------------------
      To reproduce bug:

      % uname -a
      SunOS novo37 5.5.1 Generic_103640-08 sun4m sparc SUNW,SPARCstation-10,SX
      % cd ~/tmp
      % ls
      Crasher.java
      % java -version
      java version "1.2beta2"
      % java -fullversion
      java full version "JDK-1.2beta2-V"
      % echo $CLASSPATH
      .:/export/ld32/sqe/harness_release/classes
      % javac Crasher.java ; echo "status=$status"
      status=0
      % java -verify -ms1m -mx1m Crasher ; echo "status=$status"
      java.lang.OutOfMemoryError
      at Crasher.<init>(Crasher.java:6)
      at Crasher.main(Crasher.java:25)
      java.lang.OutOfMemoryError
      SIGSEGV 11* segmentation violation
          si_signo [11]: SIGSEGV 11* segmentation violation
          si_errno [0]: Error 0
          si_code [1]: SEGV_MAPERR [addr: 0x4]

      stackbase=F0000000, stackpointer=EFFFE90C

      Full thread dump:
          "CachedReference sweeper" (TID:0xeea80ce8, sys_thread_t:0x6bccc, state:CW, thread_t: t@7, sp:0xeea116c8, stack_bottom:0xeea12000, stack_size:0x21000) prio=9
      at java.lang.Object.wait(Native Method)
      at java.lang.Object.wait(Object.java:309)
      at java.lang.Runtime.waitForMemoryAdvice(Runtime.java:569)
      at java.lang.ref.CachedReference$Sweeper.run(CachedReference.java:342)
      at java.lang.Thread.run(Thread.java:484)
          "Finalizer" (TID:0xeea80320, sys_thread_t:0x65eec, state:CW, thread_t: t@6, sp:0xeea41728, stack_bottom:0xeea42000, stack_size:0x21000) prio=8
      at java.lang.Object.wait(Native Method)
      at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:86)
      at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:99)
      at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:131)
          "Reference handler" (TID:0xeea803d0, sys_thread_t:0x5623c, state:CW, thread_t: t@5, sp:0xeea716c0, stack_bottom:0xeea72000, stack_size:0x21000) prio=10
      at java.lang.Object.wait(Native Method)
      at java.lang.Object.wait(Object.java:309)
      at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:198)
          "SIGQUIT handler" (TID:0xeea80038, sys_thread_t:0x59c94, state:R, thread_t: t@4, sp:0xeebb1b50, stack_bottom:0xeebb2000, stack_size:0x21000) prio=0
          "main" (TID:0xeea80068, sys_thread_t:0x2141c, state:R, thread_t: t@1, sp:0xeffff1b0, stack_bottom:0xf0000000, stack_size:0x800000) prio=5 *current thread*
      at java.lang.Throwable.printStackTrace0(Native Method)
      at java.lang.Throwable.printStackTrace(Throwable.java:134)
      at Crasher.main(Crasher.java:31)
      Monitor Cache Dump:
          java.lang.ref.Reference$Lock@EEA803E0/EEAB5058: <unowned>
      Waiting to be notified:
      "Reference handler" (0x5623c)
          java.lang.Object@EEA80560/EEAB56E0: <unowned>
      Waiting to be notified:
      "CachedReference sweeper" (0x6bccc)
          java.lang.ref.ReferenceQueue$Lock@EEA80330/EEAB5538: <unowned>
      Waiting to be notified:
      "Finalizer" (0x65eec)
          java.io.PrintStream@EEA80EC0/EEAB80F8: owner "main" (0x2141c, 1 entry)
      Registered Monitor Dump:
          utf8 hash table: <unowned>
          JNI pinning lock: <unowned>
          JNI global reference lock: <unowned>
          BinClass lock: <unowned>
          Class linking lock: <unowned>
          Code rewrite lock: <unowned>
          Heap lock: <unowned>
          Monitor cache expansion lock: <unowned>
          Thread queue lock: <unowned>
          Monitor registry: owner "main" (0x2141c, 1 entry)
      Abort
      status=-2147483642
      %
      -----------------------------------------------------------------
      Hook 5(hook5): test
      ======================================================================

        Attachments

          Activity

            People

            • Assignee:
              never Tom Rodriguez
              Reporter:
              ichebykisunw Igor Chebykin (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: