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

EXCEPTION_ACCESS_VIOLATION after divide by zero

    Details

    • Subcomponent:
    • Introduced In Version:
    • Resolved In Build:
      b01
    • CPU:
      x86
    • OS:
      windows_7

      Description

      FULL PRODUCT VERSION :
      java version "1.6.0_27"
      Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
      Java HotSpot(TM) 64-Bit Server VM (build 20.2-b06, mixed mode)

      FULL OS VERSION :
      Microsoft Windows [Version 6.1.7600]
      Linux lintestathon01 2.6.18-194.26.1.el5 #1 SMP Tue Nov 9 12:54:20 EST 2010 x86_64 x86_64 x86_64 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      Starting with java 1.6.0_25, java will crash when running application. Application only crashes in 64-bit mode, 32-bit mode seems fine. We have replicated the problem by running the test case below. Issue is also reproducible in 1.6.0_29.

      THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: No

      THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes

      REGRESSION. Last worked in version 6u29

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      run "java test.SegFault" with 64-bit 1.6.0_27 release on Windows 7 box

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      Expect java to gracefully exit after executing all tasks.
      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000000000012c, pid=4456, tid=6376
      #
      # JRE version: 6.0_27-b07
      # Java VM: Java HotSpot(TM) 64-Bit Server VM (20.2-b06 mixed mode windows-amd64 compressed oops)
      # Problematic frame:
      # C 0x000000000000012c
      #
      # If you would like to submit a bug report, please visit:
      # http://java.sun.com/webapps/bugreport/crash.jsp
      #

      --------------- T H R E A D ---------------

      Current thread (0x0000000006c18000): JavaThread "pool-1-thread-5" [_thread_in_Java, id=6376, stack(0x0000000007890000,0x0000000007990000)]

      siginfo: ExceptionCode=0xc0000005, ExceptionInformation=0x0000000000000008 0x000000000000012c

      Registers:
      RAX=0x0000000000000000, RBX=0x000000000798f810, RCX=0x0000000020000001, RDX=0x000000000798f798
      RSP=0x000000000798f870, RBP=0xf800603600000000, RSI=0x00000000e75f5834, RDI=0x0000000002555b22
      R8 =0x0000000006c18000, R9 =0x00000007c0008230, R10=0x000000006df24f80, R11=0x000000000798f398
      R12=0x0000000000000000, R13=0x00000000025b355c, R14=0x000000000798f800, R15=0x0000000006c18000
      RIP=0x000000000000012c, EFLAGS=0x0000000000014246

        Top of Stack: (sp=0x000000000798f870)
      0x000000000798f870: 00000007c00301b0 00000000f80060ce
      0x000000000798f880: 000000073ae4560c 000000000798f8c0
      0x000000000798f890: 000000073aead7a0 0000000000000000
      0x000000000798f8a0: 000000000798f908 0000000002555ffc
      0x000000000798f8b0: 00000007c0037db8 0000000002555ffc
      0x000000000798f8c0: 00000007c0037db8 000000000798f8c8
      0x000000000798f8d0: 000000073b09a4db 000000000798f948
      0x000000000798f8e0: 000000073b09a9f0 0000000000000000
      0x000000000798f8f0: 000000073b09a528 000000000798f8c0
      0x000000000798f900: 000000000798f940 000000000798f990
      0x000000000798f910: 0000000002555b22 0000000000000000
      0x000000000798f920: 0000000000000000 0000000000000000
      0x000000000798f930: 0000000000000000 00000007c00355d0
      0x000000000798f940: 00000007c0037db8 00000007c00355a8
      0x000000000798f950: 000000000798f950 000000073b09a644
      0x000000000798f960: 000000000798f9b8 000000073b09a9f0

      Instructions: (pc=0x000000000000012c)
      0x000000000000010c:
      [error occurred during error reporting (printing registers, top of stack, instructions near pc), id 0xc0000005]

      Register to memory mapping:

      RAX=0x0000000000000000 is an unknown value
      RBX=0x000000000798f810 is pointing into the stack for thread: 0x0000000006c18000
      RCX=0x0000000020000001 is an unknown value
      RDX=0x000000000798f798 is pointing into the stack for thread: 0x0000000006c18000
      RSP=0x000000000798f870 is pointing into the stack for thread: 0x0000000006c18000
      RBP=0xf800603600000000 is an unknown value
      RSI=0x00000000e75f5834 is an unknown value
      RDI=0x0000000002555b22 is an Interpreter codelet
      return entry points [0x00000000025551e0, 0x00000000025567a0] 5568 bytes
      R8 =0x0000000006c18000 is a thread
      R9 =0x00000007c0008230 is an oop
      java.io.PrintStream
       - klass: 'java/io/PrintStream'
      R10=0x000000006df24f80 is an unknown value
      R11=0x000000000798f398 is pointing into the stack for thread: 0x0000000006c18000
      R12=0x0000000000000000 is an unknown value
      R13=0x00000000025b2d50 [CodeBlob (0x00000000025b2d50)]
      Framesize: 12
      R14=0x000000000798f800 is pointing into the stack for thread: 0x0000000006c18000
      R15=0x0000000006c18000 is a thread


      Stack: [0x0000000007890000,0x0000000007990000], sp=0x000000000798f870, free space=1022k
      Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
      C 0x000000000000012c

      [error occurred during error reporting (printing native stack), id 0xc0000005]


      --------------- P R O C E S S ---------------

      Java Threads: ( => current thread )
        0x0000000006c40000 JavaThread "pool-1-thread-20" [_thread_in_Java, id=7304, stack(0x0000000008790000,0x0000000008890000)]
        0x0000000006c3f800 JavaThread "pool-1-thread-19" [_thread_in_Java, id=7080, stack(0x0000000008690000,0x0000000008790000)]
        0x0000000006c3e800 JavaThread "pool-1-thread-18" [_thread_in_Java, id=8348, stack(0x0000000008590000,0x0000000008690000)]
        0x0000000006c3e000 JavaThread "pool-1-thread-17" [_thread_in_Java, id=8656, stack(0x0000000008490000,0x0000000008590000)]
        0x0000000006c3d000 JavaThread "pool-1-thread-16" [_thread_in_Java, id=5760, stack(0x0000000008390000,0x0000000008490000)]
        0x0000000006c3c800 JavaThread "pool-1-thread-15" [_thread_in_Java, id=7636, stack(0x0000000008290000,0x0000000008390000)]
        0x0000000006c3c000 JavaThread "pool-1-thread-14" [_thread_in_Java, id=7312, stack(0x0000000008190000,0x0000000008290000)]
        0x0000000006c3b000 JavaThread "pool-1-thread-13" [_thread_in_Java, id=4008, stack(0x0000000008090000,0x0000000008190000)]
        0x0000000006c3a800 JavaThread "pool-1-thread-12" [_thread_in_Java, id=3916, stack(0x0000000007f90000,0x0000000008090000)]
        0x0000000006c35800 JavaThread "pool-1-thread-11" [_thread_in_Java, id=9708, stack(0x0000000007e90000,0x0000000007f90000)]
        0x0000000006c30800 JavaThread "pool-1-thread-10" [_thread_in_Java, id=4376, stack(0x0000000007d90000,0x0000000007e90000)]
        0x0000000006c2c000 JavaThread "pool-1-thread-9" [_thread_in_Java, id=6564, stack(0x0000000007c90000,0x0000000007d90000)]
        0x0000000006c29000 JavaThread "pool-1-thread-8" [_thread_in_Java, id=8804, stack(0x0000000007b90000,0x0000000007c90000)]
        0x0000000006c1c000 JavaThread "pool-1-thread-7" [_thread_in_Java, id=9944, stack(0x0000000007a90000,0x0000000007b90000)]
        0x0000000006c19000 JavaThread "pool-1-thread-6" [_thread_in_Java, id=9724, stack(0x0000000007990000,0x0000000007a90000)]
      =>0x0000000006c18000 JavaThread "pool-1-thread-5" [_thread_in_Java, id=6376, stack(0x0000000007890000,0x0000000007990000)]
        0x0000000006c17800 JavaThread "pool-1-thread-4" [_thread_in_Java, id=7924, stack(0x0000000007790000,0x0000000007890000)]
        0x0000000006c12800 JavaThread "pool-1-thread-3" [_thread_in_Java, id=1956, stack(0x0000000007690000,0x0000000007790000)]
        0x0000000006c0f000 JavaThread "pool-1-thread-2" [_thread_in_Java, id=7136, stack(0x0000000007590000,0x0000000007690000)]
        0x0000000006c0e800 JavaThread "pool-1-thread-1" [_thread_in_Java, id=4424, stack(0x0000000007490000,0x0000000007590000)]
        0x0000000006bf2000 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=2596, stack(0x0000000007290000,0x0000000007390000)]
        0x0000000006bef800 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=1712, stack(0x0000000007190000,0x0000000007290000)]
        0x0000000006bea800 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=3828, stack(0x0000000007090000,0x0000000007190000)]
        0x0000000006be7800 JavaThread "Attach Listener" daemon [_thread_blocked, id=8952, stack(0x0000000006f90000,0x0000000007090000)]
        0x0000000006be2000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=8604, stack(0x0000000006e90000,0x0000000006f90000)]
        0x000000000052a000 JavaThread "Finalizer" daemon [_thread_blocked, id=9588, stack(0x0000000006d90000,0x0000000006e90000)]
        0x0000000000528800 JavaThread "Reference Handler" daemon [_thread_blocked, id=5524, stack(0x0000000006a90000,0x0000000006b90000)]
        0x000000000036b800 JavaThread "main" [_thread_blocked, id=9940, stack(0x0000000002450000,0x0000000002550000)]

      Other Threads:
        0x0000000000520800 VMThread [stack: 0x0000000006990000,0x0000000006a90000] [id=9908]
        0x0000000006c0b800 WatcherThread [stack: 0x0000000007390000,0x0000000007490000] [id=4724]

      VM state:not at safepoint (normal execution)

      VM Mutex/Monitor currently owned by a thread: None

      Heap
       PSYoungGen total 57344K, used 24029K [0x00000007c0000000, 0x00000007c4000000, 0x0000000800000000)
        eden space 49152K, 48% used [0x00000007c0000000,0x00000007c1777510,0x00000007c3000000)
        from space 8192K, 0% used [0x00000007c3800000,0x00000007c3800000,0x00000007c4000000)
        to space 8192K, 0% used [0x00000007c3000000,0x00000007c3000000,0x00000007c3800000)
       PSOldGen total 131072K, used 0K [0x0000000740000000, 0x0000000748000000, 0x00000007c0000000)
        object space 131072K, 0% used [0x0000000740000000,0x0000000740000000,0x0000000748000000)
       PSPermGen total 21248K, used 2695K [0x000000073ae00000, 0x000000073c2c0000, 0x0000000740000000)
        object space 21248K, 12% used [0x000000073ae00000,0x000000073b0a1e18,0x000000073c2c0000)

      Code Cache [0x0000000002550000, 0x00000000027c0000, 0x0000000005550000)
       total_blobs=178 nmethods=7 adapters=125 free_code_cache=49925056 largest_free_block=5376

      Dynamic libraries:
      0x0000000000400000 - 0x000000000042e000 C:\Windows\system32\java.exe
      0x0000000077800000 - 0x00000000779ac000 C:\Windows\SYSTEM32\ntdll.dll
      0x0000000077120000 - 0x000000007723f000 C:\Windows\system32\kernel32.dll
      0x000007fefdeb0000 - 0x000007fefdf1c000 C:\Windows\system32\KERNELBASE.dll
      0x000007fefe4d0000 - 0x000007fefe5ab000 C:\Windows\system32\ADVAPI32.dll
      0x000007feff8f0000 - 0x000007feff98f000 C:\Windows\system32\msvcrt.dll
      0x000007feffaf0000 - 0x000007feffb0f000 C:\Windows\SYSTEM32\sechost.dll
      0x000007fefe350000 - 0x000007fefe47e000 C:\Windows\system32\RPCRT4.dll
      0x000000006d7f0000 - 0x000000006dfa8000 C:\Program Files\Java\jre6\bin\server\jvm.dll
      0x0000000077450000 - 0x000000007754a000 C:\Windows\system32\USER32.dll
      0x000007fefe5c0000 - 0x000007fefe627000 C:\Windows\system32\GDI32.dll
      0x000007fefe5b0000 - 0x000007fefe5be000 C:\Windows\system32\LPK.dll
      0x000007feff990000 - 0x000007feffa5a000 C:\Windows\system32\USP10.dll
      0x000007fefb470000 - 0x000007fefb4ab000 C:\Windows\system32\WINMM.dll
      0x000007feff8c0000 - 0x000007feff8ee000 C:\Windows\system32\IMM32.DLL
      0x000007feff710000 - 0x000007feff819000 C:\Windows\system32\MSCTF.dll
      0x000000006d760000 - 0x000000006d76e000 C:\Program Files\Java\jre6\bin\verify.dll
      0x000000006d3b0000 - 0x000000006d3d7000 C:\Program Files\Java\jre6\bin\java.dll
      0x000000006d7b0000 - 0x000000006d7c2000 C:\Program Files\Java\jre6\bin\zip.dll
      0x00000000779c0000 - 0x00000000779c7000 C:\Windows\system32\PSAPI.DLL
      0x000007fef8850000 - 0x000007fef8975000 C:\Windows\system32\dbghelp.dll

      VM Arguments:
      java_command: test.SegFault
      Launcher Type: SUN_STANDARD

      Environment Variables:
      JAVA_HOME=D:\build\3rd_Party\jsdk\1.6.0_27\Windows64\jre
      PATH=D:\Oracle\product\11.2.0\client_1\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Perforce;D:\build\3rd_Party\jsdk\1.6.0_19\Windows64\bin;D:\build\BuildTools\main\bin;D:\build\bin;C:\Python25;C:\Python25\Scripts;D:\build\ReviewBoard\1.5\tools\diff\bin;D:\build\bin\perl\binUSERNAME=EBroach
      OS=Windows_NT
      PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 26 Stepping 5, GenuineIntel



      --------------- S Y S T E M ---------------

      OS: Windows 7 , 64 bit Build 7600

      CPU:total 4 (4 cores per cpu, 2 threads per core) family 6 model 26 stepping 5, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, ht

      Memory: 4k page, physical 12580408k(1992792k free), swap 25158916k(12685508k free)

      vm_info: Java HotSpot(TM) 64-Bit Server VM (20.2-b06) for windows-amd64 JRE (1.6.0_27-b07), built on Jul 19 2011 01:08:22 by "java_re" with MS VC++ 8.0 (VS2005)

      time: Thu Dec 08 16:01:23 2011
      elapsed time: 0 seconds



      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package test;

      import java.util.concurrent.ArrayBlockingQueue;
      import java.util.concurrent.ThreadPoolExecutor;
      import java.util.concurrent.TimeUnit;




      public class SegFault {
          /**
           * simple calculation that does occasionaly does a divide by zero.
           */
          static class Task implements Runnable {

              private ValueHolder[] values;
              public Task(ValueHolder[] accounts) {
                  this.values = accounts;
              }
              public void run() {
                  try {
                      for (int i =0;i < 10; i++) {
                          for (ValueHolder val : values)
                          {
                              calculate(val,i);
                          }
                      }
                      System.out.println("task complete: " + Thread.currentThread().getName());
                  } catch (Exception e ) {
                      System.err.println("error with Thread: " + Thread.currentThread().getName() + " err:" + e.getMessage());
                      e.printStackTrace();
                      
                  }
              }
              
              private void calculate(ValueHolder val,double num) throws Exception
              {
                  double percent = num/val.returnValue();
                  boolean percentNotZero = percent != 0.0;
                  try {
                      // this statement is needed for the seg fault
                      MaxOverrideCalc calc = new MaxOverrideCalc(val);
                      if (!percentNotZero) {
                          return;
                      }
                  } catch (Exception e) {
                      System.err.println("cash reserve error: " + val.getCode() + " " + e.getMessage());
                  }
              }


          }
          
          public static class ValueHolder {
              double value;
              ValueHolder(double value) {
                  this.value = value;
              }
              public double returnValue() {
                  return value;
              }
              public String getCode() {
                  return value + "";
              }
          }
          
          
          public static final class MaxOverrideCalc {
              double amount;
              double pct;
              public static final String OVERRIDE = "OVERRIDE";
              public static final String MAX = "MAX";
              
              public MaxOverrideCalc(ValueHolder account) throws Exception
              {
                  // todo correct this after ref data pt
                  String paramVal = "OVERRIDE";
                  
                  if ("MAX".equals(paramVal))
                  {
                      // Needed for segmentation fault
                      initMax(account);
                  } else if ("OVERRIDE".equals(paramVal))
                  {
                  }
              }
              // needed even though it is not called.
              private void initMax(ValueHolder account) throws Exception
              {
                  pct = amount/account.returnValue() * 100.0;
              }
              

          }
          

          public static void main(String[] args)
          {
              int size = 700;
              try {
                  ValueHolder[] accounts = new ValueHolder[300];
                  for (int i = 0; i < 300; i++)
                  {
                      accounts[i] = new ValueHolder(i);
                  }
                  ThreadPoolExecutor executor = new ThreadPoolExecutor(20, 20, 10*1000, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(size));
                  
                  
                  for (int i = 0; i < 700; i++)
                  {
                      
                      executor.execute(new Task(accounts));
                  }
                  executor.shutdown();
                  executor.awaitTermination(60, TimeUnit.MINUTES);
                  System.out.println("done!!!!!!!!!!!!!!");
              } catch(Exception e


      ( This report has more than 16,000 characters and has been truncated. )

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                aeriksso Andreas Eriksson (Inactive)
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: