Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run 64-bit JVM from C code

I'm launching my Java software using a Windows launcher written in C. It basically loads the jvm.dll and uses it to initialize a JVM without using javaw.

Now, I tried to compile it on 64-bit and it loads the correct jvm.dll from the 64-bit Java installation.

Now, the Java program gets launched, but crashes with a hs_err_pid-file. It looks like AWT is crashing.

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (os_windows_x86.cpp:149), pid=8812, tid=10816
#  guarantee(result == EXCEPTION_CONTINUE_EXECUTION) failed: Unexpected result from topLevelExceptionFilter
#
# JRE version: 7.0_10-b18
# Java VM: Java HotSpot(TM) 64-Bit Server VM (23.6-b04 mixed mode windows-amd64 compressed oops)
# 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:
#   (Blah blah)


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

Current thread (0x0000000009b8c800):  JavaThread "AWT-Windows" daemon [_thread_in_native, id=10816, stack(0x000000000a3c0000,0x000000000a5c0000)]

Stack: [0x000000000a3c0000,0x000000000a5c0000]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  sun.awt.windows.WToolkit.init()Z+0
j  sun.awt.windows.WToolkit.run()V+9
j  java.lang.Thread.run()V+11
v  ~StubRoutines::call_stub

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

Java Threads: ( => current thread )
=>0x0000000009b8c800 JavaThread "AWT-Windows" daemon [_thread_in_native, id=10816, stack(0x000000000a3c0000,0x000000000a5c0000)]
  0x0000000009b8b800 JavaThread "AWT-Shutdown" [_thread_blocked, id=8348, stack(0x000000000a1c0000,0x000000000a3c0000)]
  0x0000000009b8a800 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=7176, stack(0x0000000009fc0000,0x000000000a1c0000)]
  0x0000000007e8b000 JavaThread "Service Thread" daemon [_thread_blocked, id=7228, stack(0x00000000096d0000,0x00000000098d0000)]
  0x0000000007e88000 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=9540, stack(0x00000000094d0000,0x00000000096d0000)]
  0x0000000007e76800 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=5836, stack(0x00000000092d0000,0x00000000094d0000)]
  0x0000000007e75000 JavaThread "Attach Listener" daemon [_thread_blocked, id=7696, stack(0x00000000090d0000,0x00000000092d0000)]
  0x0000000007e73800 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=5496, stack(0x0000000008ed0000,0x00000000090d0000)]
  0x0000000007dee000 JavaThread "Finalizer" daemon [_thread_blocked, id=7688, stack(0x0000000008cd0000,0x0000000008ed0000)]
  0x0000000007de5000 JavaThread "Reference Handler" daemon [_thread_blocked, id=4204, stack(0x0000000008ad0000,0x0000000008cd0000)]
  0x000000000036c800 JavaThread "main" [_thread_blocked, id=7928, stack(0x0000000000030000,0x0000000000230000)]

Other Threads:
  0x0000000007ddd800 VMThread [stack: 0x00000000088d0000,0x0000000008ad0000] [id=9680]
  0x0000000007e96000 WatcherThread [stack: 0x00000000098d0000,0x0000000009ad0000] [id=8180]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap
 PSYoungGen      total 14336K, used 1229K [0x00000000f0000000, 0x00000000f1000000, 0x0000000100000000)
  eden space 12288K, 10% used [0x00000000f0000000,0x00000000f01334a8,0x00000000f0c00000)
  from space 2048K, 0% used [0x00000000f0e00000,0x00000000f0e00000,0x00000000f1000000)
  to   space 2048K, 0% used [0x00000000f0c00000,0x00000000f0c00000,0x00000000f0e00000)
 ParOldGen       total 32768K, used 0K [0x00000000d0000000, 0x00000000d2000000, 0x00000000f0000000)
  object space 32768K, 0% used [0x00000000d0000000,0x00000000d0000000,0x00000000d2000000)
 PSPermGen       total 21248K, used 4906K [0x00000000cae00000, 0x00000000cc2c0000, 0x00000000d0000000)
  object space 21248K, 23% used [0x00000000cae00000,0x00000000cb2ca830,0x00000000cc2c0000)

Card table byte_map: [0x0000000005550000,0x0000000005700000] byte_map_base: 0x0000000004ef9000

Polling page: 0x0000000000340000

Code Cache  [0x0000000002490000, 0x0000000002700000, 0x0000000005490000)
 total_blobs=258 nmethods=2 adapters=208 free_code_cache=48728Kb largest_free_block=49896960

Compilation events (4 events):
Event: 0.521 Thread 0x0000000007e76800    1             java.math.BigInteger::destructiveMulAdd (150 bytes)
Event: 0.544 Thread 0x0000000007e76800 nmethod 1 0x00000000024f08d0 code [0x00000000024f0a00, 0x00000000024f0d38]
Event: 0.632 Thread 0x0000000007e88000    2             java.lang.String::hashCode (55 bytes)
Event: 0.637 Thread 0x0000000007e88000 nmethod 2 0x00000000024f2990 code [0x00000000024f2ac0, 0x00000000024f2c38]

GC Heap History (0 events):
No events

Deoptimization events (0 events):
No events

Internal exceptions (10 events):
Event: 0.621 Thread 0x000000000036c800 Threw 0x00000000f008ef40 at C:\jdk7u2_64p\jdk7u10\hotspot\src\share\vm\prims\jni.cpp:716
Event: 0.651 Thread 0x000000000036c800 Threw 0x00000000f00a1190 at C:\jdk7u2_64p\jdk7u10\hotspot\src\share\vm\prims\jvm.cpp:1166
Event: 0.654 Thread 0x000000000036c800 Threw 0x00000000f00a4370 at C:\jdk7u2_64p\jdk7u10\hotspot\src\share\vm\prims\jni.cpp:716
Event: 0.654 Thread 0x000000000036c800 Threw 0x00000000f00a4518 at C:\jdk7u2_64p\jdk7u10\hotspot\src\share\vm\prims\jni.cpp:716
Event: 0.654 Thread 0x000000000036c800 Threw 0x00000000f00a4690 at C:\jdk7u2_64p\jdk7u10\hotspot\src\share\vm\prims\jni.cpp:716
Event: 0.665 Thread 0x000000000036c800 Threw 0x00000000f00b5bf0 at C:\jdk7u2_64p\jdk7u10\hotspot\src\share\vm\prims\jvm.cpp:1166
Event: 0.665 Thread 0x000000000036c800 Threw 0x00000000f00b5d18 at C:\jdk7u2_64p\jdk7u10\hotspot\src\share\vm\prims\jvm.cpp:1166
Event: 0.676 Thread 0x000000000036c800 Threw 0x00000000f00b9238 at C:\jdk7u2_64p\jdk7u10\hotspot\src\share\vm\prims\jvm.cpp:1166
Event: 0.677 Thread 0x000000000036c800 Threw 0x00000000f00b9360 at C:\jdk7u2_64p\jdk7u10\hotspot\src\share\vm\prims\jvm.cpp:1166
Event: 0.813 Thread 0x000000000036c800 Threw 0x00000000f00d73f8 at C:\jdk7u2_64p\jdk7u10\hotspot\src\share\vm\prims\jni.cpp:716

Events (10 events):
Event: 0.829 loading class 0x0000000009b17db0 done
Event: 0.829 loading class 0x0000000009afb160
Event: 0.829 loading class 0x0000000009afb160 done
Event: 0.831 loading class 0x0000000009b7ae20
Event: 0.832 loading class 0x0000000009b7ae20 done
Event: 0.835 Thread 0x0000000009b8a800 Thread added: 0x0000000009b8a800
Event: 0.838 loading class 0x0000000009b1f1f0
Event: 0.838 loading class 0x0000000009b1f1f0 done
Event: 0.842 Thread 0x0000000009b8b800 Thread added: 0x0000000009b8b800
Event: 0.903 Thread 0x0000000009b8c800 Thread added: 0x0000000009b8c800


Dynamic libraries:
0x0000000000400000 - 0x0000000000454000     C:\Users\Username\Desktop\Launcher 2\bin\Launcher.exe
0x00000000776e0000 - 0x0000000077889000     C:\Windows\SYSTEM32\ntdll.dll
0x00000000775c0000 - 0x00000000776df000     C:\Windows\system32\KERNEL32.dll
0x000007fefd6e0000 - 0x000007fefd74b000     C:\Windows\system32\KERNELBASE.dll
0x000007fefe2d0000 - 0x000007fefe3ab000     C:\Windows\system32\ADVAPI32.dll
0x000007fefdb50000 - 0x000007fefdbef000     C:\Windows\system32\msvcrt.dll
0x000007fefda00000 - 0x000007fefda1f000     C:\Windows\SYSTEM32\sechost.dll
0x000007feff4c0000 - 0x000007feff5ed000     C:\Windows\system32\RPCRT4.dll
0x00000000774c0000 - 0x00000000775ba000     C:\Windows\system32\USER32.dll
0x000007feff910000 - 0x000007feff977000     C:\Windows\system32\GDI32.dll
0x000007feff900000 - 0x000007feff90e000     C:\Windows\system32\LPK.dll
0x000007feff5f0000 - 0x000007feff6b9000     C:\Windows\system32\USP10.dll
0x000007feff8d0000 - 0x000007feff8fe000     C:\Windows\system32\IMM32.DLL
0x000007fefde60000 - 0x000007fefdf69000     C:\Windows\system32\MSCTF.dll
0x0000000057bb0000 - 0x00000000582cf000     C:\Program Files\Java\jre7\bin\server\jvm.dll
0x000007fefa5f0000 - 0x000007fefa5f9000     C:\Windows\system32\WSOCK32.dll
0x000007feff980000 - 0x000007feff9cd000     C:\Windows\system32\WS2_32.dll
0x000007fefde50000 - 0x000007fefde58000     C:\Windows\system32\NSI.dll
0x000007fefa530000 - 0x000007fefa56b000     C:\Windows\system32\WINMM.dll
0x00000000778b0000 - 0x00000000778b7000     C:\Windows\system32\PSAPI.DLL
0x0000000071fa0000 - 0x0000000072072000     C:\Windows\system32\MSVCR100.dll
0x0000000071060000 - 0x000000007106f000     C:\Program Files\Java\jre7\bin\verify.dll
0x000000006b0a0000 - 0x000000006b0c8000     C:\Program Files\Java\jre7\bin\java.dll
0x000000006ca30000 - 0x000000006ca45000     C:\Program Files\Java\jre7\bin\zip.dll
0x000000005e580000 - 0x000000005e713000     C:\Program Files\Java\jre7\bin\awt.dll
0x000007fefe1f0000 - 0x000007fefe2c7000     C:\Windows\system32\OLEAUT32.dll
0x000007feff6c0000 - 0x000007feff8c3000     C:\Windows\system32\ole32.dll
0x000007fef96a0000 - 0x000007fef96b8000     C:\Windows\system32\DWMAPI.DLL

VM Arguments:
java_command: <unknown>
Launcher Type: generic

Environment Variables:
JRE_HOME=C:\Program Files\Java\jre7
PATH=(Blah blah)
USERNAME=Username
OS=Windows_NT
PROCESSOR_IDENTIFIER=AMD64 Family 15 Model 107 Stepping 2, AuthenticAMD



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

OS: Windows 7 , 64 bit Build 7601 Service Pack 1

CPU:total 2 (2 cores per cpu, 1 threads per core) family 15 model 107 stepping 2, cmov, cx8, fxsr, mmx, sse, sse2, sse3, mmxext, 3dnowpref, tsc

Memory: 4k page, physical 3144952k(861460k free), swap 7633028k(3062020k free)

vm_info: Java HotSpot(TM) 64-Bit Server VM (23.6-b04) for windows-amd64 JRE (1.7.0_10-b18), built on Nov 28 2012 05:00:40 by "java_re" with unknown MS VC++:1600

time: Tue Sep 10 22:20:47 2013
elapsed time: 1 seconds
like image 878
das_j Avatar asked Sep 10 '13 20:09

das_j


2 Answers

And are you asking what you can do to fix this?

A very very good document regarding this topic is Troubleshooting Guide for Java from (originally) Sun. See the chapter "Troubleshooting System Crashes" for information about hs_err_pid* Files.

See Appendix C - Fatal Error Log

and side note that hs_err_pid.log files only get created if there is an actual JVM crash. If your application "only" quits due to an unhandled exception somewhere, then no such file will be created.

Are you sure that the crash was a real JVM crash?

like image 157
Amealy Avatar answered Sep 20 '22 06:09

Amealy


So, I found and fixed the problem. I had an Application Manifest (MSDN) which had the processor architecture defined to x86. I changed it to * what solved the problem.

like image 44
das_j Avatar answered Sep 21 '22 06:09

das_j