У меня странная ситуация в моем проекте с использованием 64-битной платформы Windows.
- Проект включает в себя вызовы JNI.
- Для проекта требуется установить переменную окружения "My_Env".
- Эта переменная внутренне используется Java-классами для загрузки некоторых Dll (64-битных).
Эта цель "Junit" вызывается из сборки Ant вместе с некоторыми другими целями в определенной последовательности. Первоначально переменная окружения "My_Env" не была установлена на 64-битную. Когда я запускал все цели муравья в последовательности, JVM падал на цель Junit. Даже при запуске одной цели Junit JVM падал.
Тогда я понял, что «My_ENv» не был установлен, и установил его. Теперь, когда я запускаю только цель Junit, она работает без сбоев. Однако при запуске цели по умолчанию для сборки ant (которая включает все цели в последовательности) JVM по-прежнему падает на цель Junit.
Цель Junit имеет "fork=on
".
The error report is as following:
># A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000180001051, pid=4172, tid=4608
#
# JRE version: 6.0_27-b01
# Java VM: Java HotSpot(TM) 64-Bit Server VM (20.2-b01 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C [MyDLL.dll+0x1051]
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/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 (0x000000000051b800): JavaThread "main" [_thread_in_native, id=4608, stack(0x0000000000de0000,0x0000000000ee0000)]
siginfo: ExceptionCode=0xc0000005, reading address 0x0000000000000000
Registers:
RAX=0x0000000000000000, RBX=0x0000000000000000, RCX=0xfffffffffffffff5, RDX=0x0000000000000000
RSP=0x0000000000edea00, RBP=0x0000000000edeaa8, RSI=0x00000000faf53270, RDI=0x000000018000362a
R8 =0x7efefefefefefeff, R9 =0x7efefefefefeff6e, R10=0x0000000005497f21, R11=0x8101010101010100
R12=0x0000000000000000, R13=0x00000000fb4104d8, R14=0x0000000000edeac0, R15=0x000000000051b800
RIP=0x0000000180001051, EFLAGS=0x0000000000010246
Top of Stack: (sp=0x0000000000edea00)
0x0000000000edea00: 000000000051c5a0 0000000000ef11d2
0x0000000000edea10: 00000000fb4104d8 0000000000edeaa8
0x0000000000edea20: fffffffffffffffe 0000000000ee5b22
0x0000000000edea30: 0000000000ee5b22 0000000000ef1346
0x0000000000edea40: 00000000fb4104d8 000000000051c598
0x0000000000edea50: 000000000051c500 000000000051b800
0x0000000000edea60: 00000000fffffffe 0000000000edea68
0x0000000000edea70: 00000000fb4104d8 0000000000edeac0
0x0000000000edea80: 00000000fb410830 0000000000000000
0x0000000000edea90: 00000000fb4104d8 0000000000000000
0x0000000000edeaa0: 0000000000edeac8 0000000000edeb08
0x0000000000edeab0: 0000000000ee5b22 00000000fb4107c8
0x0000000000edeac0: 0000000000eee338 0000000000edeac8
0x0000000000edead0: 00000000fb40ff20 0000000000edeb10
0x0000000000edeae0: 00000000fb410270 0000000000000000
0x0000000000edeaf0: 00000000fb40ff28 0000000000edeac8
Instructions: (pc=0x0000000180001051)
0x0000000180001031: 00 0f b7 0d 67 11 00 00 66 89 0d e8 25 00 00 48
0x0000000180001041: 8d 3d d9 25 00 00 33 c0 48 83 c9 ff f2 ae 33 d2
0x0000000180001051: 0f b6 04 13 88 44 17 ff 48 ff c2 84 c0 75 f1 48
0x0000000180001061: 8d 15 b9 25 00 00 48 8d 0d 3a 11 00 00 ff 15 1c
Register to memory mapping:
RAX=0x0000000000000000 is an unknown value
RBX=0x0000000000000000 is an unknown value
RCX=0xfffffffffffffff5 is an unknown value
RDX=0x0000000000000000 is an unknown value
RSP=0x0000000000edea00 is pointing into the stack for thread: 0x000000000051b800
RBP=0x0000000000edeaa8 is pointing into the stack for thread: 0x000000000051b800
RSI=0x00000000faf53270 is an oop
{instance class}
- klass: {other class}
RDI=0x000000018000362a is an unknown value
R8 =0x7efefefefefefeff is an unknown value
R9 =0x7efefefefefeff6e is an unknown value
R10=0x0000000005497f21 is an unknown value
R11=0x8101010101010100 is an unknown value
R12=0x0000000000000000 is an unknown value
R13=0x00000000fb4104d8 is an oop
{method}
- klass: {other class}
R14=0x0000000000edeac0 is pointing into the stack for thread: 0x000000000051b800
R15=0x000000000051b800 is a thread
Stack: [0x0000000000de0000,0x0000000000ee0000], sp=0x0000000000edea00, free space=1018k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [MyDLL.dll+0x1051] init+0x51
j src.com.MyDLL.init()V+0
j src.com.MyClass.initMyDLL()V+108
j src.com.MyClass.<init>(Lsrc/com/Configuration;)V+21
j src.com.MyUtil.testLoadFiles()V+113
v ~StubRoutines::call_stub
V [jvm.dll+0x1e9af7]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j src.com.MyDLLJNI.init()V+0
j src.com.MyDLL.init()V+0
j src.com.MyClass.initMyDLL()V+108
j src.com.MyClass.<init>(Lsrc/com/Configuration;)V+21
j src.com.MyUtil.testLoadFiles()V+113
v ~StubRoutines::call_stub
j sun.reflect.NativeMethodAccessorImpl.invoke0(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+0
j sun.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+87
j sun.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+6
j java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+161
j junit.framework.TestCase.runTest()V+107
j junit.framework.TestCase.runBare()V+7
j junit.framework.TestResult$1.protect()V+4
j junit.framework.TestResult.runProtected(Ljunit/framework/Test;Ljunit/framework/Protectable;)V+1
j junit.framework.TestResult.run(Ljunit/framework/TestCase;)V+18
j junit.framework.TestCase.run(Ljunit/framework/TestResult;)V+2
j junit.framework.TestSuite.runTest(Ljunit/framework/Test;Ljunit/framework/TestResult;)V+2
j junit.framework.TestSuite.run(Ljunit/framework/TestResult;)V+40
j junit.framework.TestSuite.runTest(Ljunit/framework/Test;Ljunit/framework/TestResult;)V+2
j junit.framework.TestSuite.run(Ljunit/framework/TestResult;)V+40
j org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run()V+431
j org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(Lorg/apache/tools/ant/taskdefs/optional/junit/JUnitTest;ZZZZZZ)I+39
j org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main([Ljava/lang/String;)V+741
v ~StubRoutines::call_stub
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
0x0000000000610000 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=4884, stack(0x0000000004b70000,0x0000000004c70000)]
0x000000000060e800 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=3216, stack(0x0000000004a70000,0x0000000004b70000)]
0x00000000005fd000 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=4436, stack(0x0000000004970000,0x0000000004a70000)]
0x00000000005fb800 JavaThread "Attach Listener" daemon [_thread_blocked, id=4748, stack(0x0000000004870000,0x0000000004970000)]
0x00000000005f7800 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=2688, stack(0x0000000004770000,0x0000000004870000)]
0x00000000005e8000 JavaThread "Finalizer" daemon [_thread_blocked, id=4824, stack(0x0000000004470000,0x0000000004570000)]
0x00000000005e0000 JavaThread "Reference Handler" daemon [_thread_blocked, id=4676, stack(0x0000000004370000,0x0000000004470000)]
=>0x000000000051b800 JavaThread "main" [_thread_in_native, id=4608, stack(0x0000000000de0000,0x0000000000ee0000)]
Other Threads:
0x00000000005da000 VMThread [stack: 0x0000000004270000,0x0000000004370000] [id=4480]
0x000000000061f000 WatcherThread [stack: 0x0000000004c70000,0x0000000004d70000] [id=4768]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap
def new generation total 19648K, used 2455K [0x00000000bae00000, 0x00000000bc350000, 0x00000000d0350000)
eden space 17472K, 14% used [0x00000000bae00000, 0x00000000bb065d08, 0x00000000bbf10000)
from space 2176K, 0% used [0x00000000bbf10000, 0x00000000bbf10000, 0x00000000bc130000)
to space 2176K, 0% used [0x00000000bc130000, 0x00000000bc130000, 0x00000000bc350000)
tenured generation total 43712K, used 0K [0x00000000d0350000, 0x00000000d2e00000, 0x00000000fae00000)
the space 43712K, 0% used [0x00000000d0350000, 0x00000000d0350000, 0x00000000d0350200, 0x00000000d2e00000)
compacting perm gen total 21248K, used 6210K [0x00000000fae00000, 0x00000000fc2c0000, 0x0000000100000000)
the space 21248K, 29% used [0x00000000fae00000, 0x00000000fb410878, 0x00000000fb410a00, 0x00000000fc2c0000)
No shared spaces configured.
Code Cache [0x0000000000ee0000, 0x0000000001150000, 0x0000000003ee0000)
total_blobs=233 nmethods=13 adapters=174 free_code_cache=49891776 largest_free_block=12160
Dynamic libraries:
0x0000000000400000 - 0x000000000042e000 C:\Java\jdk1.6.0_27\jre\bin\java.exe
0x0000000077b90000 - 0x0000000077d39000 C:\Windows\SYSTEM32\ntdll.dll
0x0000000077970000 - 0x0000000077a8f000 C:\Windows\system32\kernel32.dll
0x000007fefdb90000 - 0x000007fefdbfc000 C:\Windows\system32\KERNELBASE.dll
0x000007fefe260000 - 0x000007fefe33b000 C:\Windows\system32\ADVAPI32.dll
0x000007feffe00000 - 0x000007feffe9f000 C:\Windows\system32\msvcrt.dll
0x000007fefe540000 - 0x000007fefe55f000 C:\Windows\SYSTEM32\sechost.dll
0x000007fefe5d0000 - 0x000007fefe6fd000 C:\Windows\system32\RPCRT4.dll
0x000000006d890000 - 0x000000006e048000 C:\Java\jdk1.6.0_27\jre\bin\server\jvm.dll
0x0000000077a90000 - 0x0000000077b8a000 C:\Windows\system32\USER32.dll
0x000007fefe560000 - 0x000007fefe5c7000 C:\Windows\system32\GDI32.dll
0x000007feffdf0000 - 0x000007feffdfe000 C:\Windows\system32\LPK.dll
0x000007fefe190000 - 0x000007fefe259000 C:\Windows\system32\USP10.dll
0x000007fefa260000 - 0x000007fefa29b000 C:\Windows\system32\WINMM.dll
0x000007feff4e0000 - 0x000007feff50e000 C:\Windows\system32\IMM32.DLL
0x000007fefdec0000 - 0x000007fefdfc9000 C:\Windows\system32\MSCTF.dll
0x000000006d800000 - 0x000000006d80e000 C:\Java\jdk1.6.0_27\jre\bin\verify.dll
0x000000006d450000 - 0x000000006d477000 C:\Java\jdk1.6.0_27\jre\bin\java.dll
0x0000000077d60000 - 0x0000000077d67000 C:\Windows\system32\PSAPI.DLL
0x000000006d850000 - 0x000000006d862000 C:\Java\jdk1.6.0_27\jre\bin\zip.dll
0x000000006d6a0000 - 0x000000006d6b7000 C:\Java\jdk1.6.0_27\jre\bin\net.dll
0x000007feff490000 - 0x000007feff4dd000 C:\Windows\system32\WS2_32.dll
0x000007fefdeb0000 - 0x000007fefdeb8000 C:\Windows\system32\NSI.dll
0x000007fefd2d0000 - 0x000007fefd325000 C:\Windows\system32\mswsock.dll
0x000007fefd540000 - 0x000007fefd547000 C:\Windows\System32\wship6.dll
0x000007fefc670000 - 0x000007fefc685000 C:\Windows\system32\NLAapi.dll
0x000007fefa630000 - 0x000007fefa645000 C:\Windows\system32\napinsp.dll
0x000007fefd160000 - 0x000007fefd1bb000 C:\Windows\system32\DNSAPI.dll
0x000007fefa660000 - 0x000007fefa66b000 C:\Windows\System32\winrnr.dll
0x000007fefccf0000 - 0x000007fefccf7000 C:\Windows\System32\wshtcpip.dll
0x000007fefb650000 - 0x000007fefb677000 C:\Windows\system32\IPHLPAPI.DLL
0x000007fefb640000 - 0x000007fefb64b000 C:\Windows\system32\WINNSI.DLL
0x000007fefa880000 - 0x000007fefa888000 C:\Windows\system32\rasadhlp.dll
0x000007fefac40000 - 0x000007fefac93000 C:\Windows\System32\fwpuclnt.dll
0x0000000180000000 - 0x0000000180007000 C:project\output\bin\MyDLL.dll
0x0000000072bb0000 - 0x0000000072c82000 C:\Windows\system32\MSVCR100.dll
VM Arguments:
jvm_args: -Djava.library.path=C:\project\output\bin
java_command: org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner src.com.AllTests filtertrace=true haltOnError=false haltOnFailure=false showoutput=false outputtoformatters=true logtestlistenerevents=true formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,C:\project\unittests\junit-results\TEST-AllTests.xml crashfile=C:\project\junitvmwatcher7335361868739082409.properties propsfile=C:\project\junit3775055844850964019.properties
Launcher Type: SUN_STANDARD
Environment Variables:
JAVA_HOME=C:\Java\jdk1.6.0_27
PATH=C:\project\output\bin
USERNAME=relmgr
OS=Windows_NT
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 26 Stepping 5, GenuineIntel
--------------- S Y S T E M ---------------
OS: Windows NT 6.1 Build 7601 Service Pack 1
CPU:total 1 (1 cores per cpu, 1 threads per core) family 6 model 26 stepping 5, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt
Memory: 4k page, physical 4193848k(2877556k free), swap 8385848k(6803796k free)
vm_info: Java HotSpot(TM) 64-Bit Server VM (20.2-b01) for windows-amd64 JRE (1.6.0_27-ea-b01), built on May 18 2011 08:17:50 by "java_re" with MS VC++ 8.0 (VS2005)
time: Fri Jan 27 07:03:19 2012
elapsed time: 4 seconds
А вот кусок муравья, цель Junit, если это поможет:
<target name="Junit" depends="JunitCompile" >
<delete dir="${Junit.Results}"/>
<mkdir dir="${Junit.Results}"/>
<property name="fs" value="${file.separator}"/>
<property name="path" value="${basedir}${fs}${project.dir}${fs}bin"/>
<!-- junit errorProperty="test.failed" failureProperty="test.failed" fork="on" -->
<junit errorProperty="test.failed" fork="on">
<env key="Path" value="${path}"/>
<jvmarg value="-Djava.library.path=${basedir}${fs}${project.dir}${fs}bin"/>
<test name="${test.class}" todir="${Junit.Results}"/>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<classpath refid="classpath"/>
</junit>
</target>