JVM BUG: Internal Error (classFileParser.cpp:3161), pid=1116, tid=3912 Error: ShouldNotReachHere()

简介: 涉及到线程安全的部分出现了JVM BUG——不解,Eclipse返回的信息如下, # # A fatal error has been detected by the Java Runtime Environment: # #  Internal Error (classFileParser.

涉及到线程安全的部分出现了JVM BUG——不解,Eclipse返回的信息如下,



#

# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (classFileParser.cpp:3161), pid=1116, tid=3912
#  Error: ShouldNotReachHere()
#
# JRE version: 6.0_21-b07
# Java VM: Java HotSpot(TM) Client VM (17.0-b17 mixed mode windows-x86 )
# An error report file with more information is saved as:

# D:\user\workspace\MultiThread\hs_err_pid1116.log


MultiThread\hs_err_pid1116.log的内容:


#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (classFileParser.cpp:3161), pid=1116, tid=3912
#  Error: ShouldNotReachHere()
#
# JRE version: 6.0_21-b07
# Java VM: Java HotSpot(TM) Client VM (17.0-b17 mixed mode windows-x86 )
# 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 (0x01ad9000):  JavaThread "Unknown thread" [_thread_in_vm, id=3912, stack(0x00260000,0x002b0000)]


Stack: [0x00260000,0x002b0000],  sp=0x002af880,  free space=13e002af890k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [jvm.dll+0x1fd090]
V  [jvm.dll+0xa47c9]
V  [jvm.dll+0x75f01]
V  [jvm.dll+0x775a4]
V  [jvm.dll+0x1cbcb5]
V  [jvm.dll+0x1cc3ed]
V  [jvm.dll+0x1cc7a5]
V  [jvm.dll+0x1cc7eb]
V  [jvm.dll+0x1cc912]
V  [jvm.dll+0x1cc98a]
V  [jvm.dll+0x1cce3d]
V  [jvm.dll+0x1cd252]
V  [jvm.dll+0x1eceb3]
V  [jvm.dll+0x1ed28c]
V  [jvm.dll+0xdb721]
V  [jvm.dll+0x1e6618]
V  [jvm.dll+0x1065d0]
C  [javaw.exe+0x1657]
C  [javaw.exe+0x1e2c]
C  [javaw.exe+0x8614]
C  [kernel32.dll+0x4ed6c]
C  [ntdll.dll+0x6377b]
C  [ntdll.dll+0x6374e]




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


Java Threads: ( => current thread )


Other Threads:


=>0x01ad9000 (exited) JavaThread "Unknown thread" [_thread_in_vm, id=3912, stack(0x00260000,0x002b0000)]


VM state:not at safepoint (not fully initialized)


VM Mutex/Monitor currently owned by a thread: None


Dynamic libraries:
0x00400000 - 0x00424000 C:\Program Files\Java\jdk1.6.0_21\bin\javaw.exe
0x775f0000 - 0x7772c000 C:\Windows\SYSTEM32\ntdll.dll
0x76bd0000 - 0x76ca4000 C:\Windows\system32\kernel32.dll
0x75860000 - 0x758aa000 C:\Windows\system32\KERNELBASE.dll
0x77430000 - 0x774d0000 C:\Windows\system32\ADVAPI32.dll
0x76d90000 - 0x76e3c000 C:\Windows\system32\msvcrt.dll
0x75c20000 - 0x75c39000 C:\Windows\SYSTEM32\sechost.dll
0x75a80000 - 0x75b21000 C:\Windows\system32\RPCRT4.dll
0x77360000 - 0x77429000 C:\Windows\system32\USER32.dll
0x75da0000 - 0x75dee000 C:\Windows\system32\GDI32.dll
0x777b0000 - 0x777ba000 C:\Windows\system32\LPK.dll
0x772c0000 - 0x7735d000 C:\Windows\system32\USP10.dll
0x77760000 - 0x7777f000 C:\Windows\system32\IMM32.DLL
0x75df0000 - 0x75ebc000 C:\Windows\system32\MSCTF.dll
0x7c340000 - 0x7c396000 C:\Program Files\Java\jdk1.6.0_21\jre\bin\msvcr71.dll
0x6d8b0000 - 0x6db57000 C:\Program Files\Java\jdk1.6.0_21\jre\bin\client\jvm.dll
0x73c80000 - 0x73cb2000 C:\Windows\system32\WINMM.dll
0x756b0000 - 0x756fc000 C:\Windows\system32\apphelp.dll
0x6d860000 - 0x6d86c000 C:\Program Files\Java\jdk1.6.0_21\jre\bin\verify.dll
0x6d3e0000 - 0x6d3ff000 C:\Program Files\Java\jdk1.6.0_21\jre\bin\java.dll
0x6d340000 - 0x6d348000 C:\Program Files\Java\jdk1.6.0_21\jre\bin\hpi.dll
0x77750000 - 0x77755000 C:\Windows\system32\PSAPI.DLL
0x6d8a0000 - 0x6d8af000 C:\Program Files\Java\jdk1.6.0_21\jre\bin\zip.dll


VM Arguments:
jvm_args: -Dfile.encoding=UTF-8 -Xbootclasspath:C:\Program Files\Android\android-sdk\platforms\android-14\android.jar 
java_command: com.gogler.MultiThread.ThreadSafeDemo
Launcher Type: SUN_STANDARD


Environment Variables:
JAVA_HOME=C:\Program Files\Java\jdk1.6.0_21
CLASSPATH=.;C:\Program Files\Java\jdk1.6.0_21\lib\tools.jar;C:\Program Files\Java\jdk1.6.0_21\lib\dt.jar;C:\Program Files\Java\jdk1.6.0_21\bin;
PATH=C:/Program Files/Java/jre6/bin/client;C:/Program Files/Java/jre6/bin;C:/Program Files/Java/jre6/lib/i386;C:\Program Files\Common Files\NetSarang;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\Program Files\TortoiseSVN\bin;C:\Program Files\Java\jdk1.6.0_21\bin;F:\android-sdk-windows\android-sdk-windows\tools;F:\android-sdk-windows\android-sdk-windows\platform-tools;d:\Program Files\DBank\ClickUp;C:\Users\Administrator\Downloads\eclipse-SDK-3.7-win32\eclipse;
USERNAME=Administrator
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 6 Model 23 Stepping 10, GenuineIntel






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


OS: Windows 7 Build 7601 Service Pack 1


CPU:total 2 (2 cores per cpu, 1 threads per core) family 6 model 23 stepping 10, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3


Memory: 4k page, physical 3634232k(2249368k free), swap 7266708k(5328364k free)


vm_info: Java HotSpot(TM) Client VM (17.0-b17) for windows-x86 JRE (1.6.0_21-b07), built on Jul 17 2010 01:10:15 by "java_re" with MS VC++ 7.1 (VS2003)


time: Sat Apr 28 17:11:19 2012
elapsed time: 0 seconds



执行的代码:


package com.gogler.MultiThread;
//Java语言: ArrayList的线程安全与不安全对比演示
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;

public class ThreadSafeDemo {
	
    public static int demo(final List list, final int testCount) throws InterruptedException {
        ThreadGroup group = new ThreadGroup(list.getClass().getName() + "@" + list.hashCode()); 
        final Random rand = new Random(); 
        
        Runnable listAppender = new Runnable() {
            public void run() {
                try {
                    Thread.sleep(rand.nextInt(2));
                } catch (InterruptedException e) {
                    return; 
                } 
                list.add("0"); 
            }
        }; 
        
        for (int i = 0; i < testCount; i++) {
            new Thread(group, listAppender, "InsertList-" + i).start(); 
        }
        
        while (group.activeCount() > 0) {
            Thread.sleep(10); 
        }
        
        return list.size(); 
    }
    public static void main(String[] args) throws InterruptedException {
        List unsafeList = new ArrayList(); 
        List safeList = Collections.synchronizedList(new ArrayList()); 
        final int N = 10000; 
        for (int i = 0; i < 10; i++) {
            unsafeList.clear(); 
            safeList.clear(); 
            int unsafeSize = demo(unsafeList, N); 
            int safeSize = demo(safeList, N); 
            System.out.println("unsafe/safe: " + unsafeSize + "/" + safeSize); 
        }
    }
}




相关文章
|
4月前
|
Java 编译器 Linux
JVM/编译器/CPU,究竟谁是卧底?一个曾经困扰我一个月的 bug
任何复杂的系统都可能因为一个小小的疏漏而无法运转,本文记录了一个困扰作者一个月的 bug 最终拨云见日的过程。
分享一个新出炉的JVM里不痛不痒的BUG(Attach机制相关)
分享一个新出炉的JVM里不痛不痒的BUG(Attach机制相关)
分享一个新出炉的JVM里不痛不痒的BUG(Attach机制相关)
|
缓存 Java C语言
一个导致JVM物理内存消耗大的Bug
一个导致JVM物理内存消耗大的Bug
一个导致JVM物理内存消耗大的Bug
|
监控 安全 Java
JVM Bug:多个线程持有一把锁?
JVM Bug:多个线程持有一把锁?
JVM Bug:多个线程持有一把锁?
|
18天前
|
缓存 Prometheus 监控
Elasticsearch集群JVM调优设置合适的堆内存大小
Elasticsearch集群JVM调优设置合适的堆内存大小
158 1
|
2月前
|
存储 安全 Java
jvm 锁的 膨胀过程?锁内存怎么变化的
【10月更文挑战第3天】在Java虚拟机(JVM)中,`synchronized`关键字用于实现同步,确保多个线程在访问共享资源时的一致性和线程安全。JVM对`synchronized`进行了优化,以适应不同的竞争场景,这种优化主要体现在锁的膨胀过程,即从偏向锁到轻量级锁,再到重量级锁的转变。下面我们将详细介绍这一过程以及锁在内存中的变化。
40 4
|
8天前
|
存储 监控 算法
深入探索Java虚拟机(JVM)的内存管理机制
本文旨在为读者提供对Java虚拟机(JVM)内存管理机制的深入理解。通过详细解析JVM的内存结构、垃圾回收算法以及性能优化策略,本文不仅揭示了Java程序高效运行背后的原理,还为开发者提供了优化应用程序性能的实用技巧。不同于常规摘要仅概述文章大意,本文摘要将简要介绍JVM内存管理的关键点,为读者提供一个清晰的学习路线图。
|
17天前
|
Java
JVM内存参数
-Xmx[]:堆空间最大内存 -Xms[]:堆空间最小内存,一般设置成跟堆空间最大内存一样的 -Xmn[]:新生代的最大内存 -xx[use 垃圾回收器名称]:指定垃圾回收器 -xss:设置单个线程栈大小 一般设堆空间为最大可用物理地址的百分之80
|
18天前
|
Java
JVM运行时数据区(内存结构)
1)虚拟机栈:每次调用方法都会在虚拟机栈中产生一个栈帧,每个栈帧中都有方法的参数、局部变量、方法出口等信息,方法执行完毕后释放栈帧 (2)本地方法栈:为native修饰的本地方法提供的空间,在HotSpot中与虚拟机合二为一 (3)程序计数器:保存指令执行的地址,方便线程切回后能继续执行代码
19 3