如果在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個就會出問題。