如果在java环境下运行多线程程序时报如下错误:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000000f637323, pid=10960, tid=10428
#
# JRE version: Java(TM) SE Runtime Environment (7.0_55-b13) (build 1.7.0_55-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.55-b03 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C 0x000000000f637323
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
--------------- T H R E A D ---------------
Current thread (0x0000000017c31000): JavaThread "pool-1-thread-2" [_thread_in_native, id=10428, stack(0x0000000019fb0000,0x000000001a0b0000)]
siginfo: ExceptionCode=0xc0000005, reading address 0xffffffffffffffff
Registers:
RAX=0x000000000d6d0b5d, RBX=0x0000002700000009, RCX=0x000000001112b450, RDX=0x0000000000000009
RSP=0x000000001a0ae2c0, RBP=0x000000001a0ae339, RSI=0x0000000000000027, RDI=0x000000001a0ae4a8
R8 =0x0000000000000027, R9 =0x0000000000000000, R10=0x000000001d3d0fe0, R11=0x000000001a0ae360
R12=0x0000000000000000, R13=0x00000000ffffd8f1, R14=0x000000001112b450, R15=0x0000000000000000
RIP=0x000000000f637323, EFLAGS=0x0000000000010246
则有可能是线程池添加的线程数量超过了设定的数量,例如:
CountDownLatch threadSignal = new CountDownLatch(10);//这里设定了线程池是总共允许10个线程。
Executor executor = Executors.newCachedThreadPool();
但executor.execute(task);的数量如过超过10个就会出问题。