JDK-5071086 : Invoking JNI_CreateJavaVM() from jvm.dll crashes
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2004-07-02
  • Updated: 2012-11-02
  • Resolved: 2004-07-21
Description

Name: gm110360			Date: 07/02/2004


FULL PRODUCT VERSION :
java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b51)
Java HotSpot(TM) Client VM (build 1.5.0-beta2-b51, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
I am using LoadLibrary() and GetProcAddress() to call JNI_CreateJavaVM() from jvm.dll. This works fine from a normal application. In my application, however, I am subclassing SysListView32's WindowProc and causing it to create a JVM within its process-space. When I do this, the call crashes with:

Unhandled exception at 0x6d67d8b8 in
explorer.exe: 0xC0000005: Access violation reading location 0x00000000.

    and it looks like there is possibly a stack-overflow by looking at the call-stack window. If, however, I link statically against jvm.lib and invoke JNI_CreateJavaVM() from it, it loads fine. I went to great lengths to verify my arguments and code against both JDK 1.4.2_04 and JDK 1.5 beta 2. My VM creation routine is taken directly from the JNI_CreateJavaVM() sample in the JNI  documentation.

  From this I conclude that there is some sort of bug in JNI_CreateJavaVM() in JVM.DLL but I need Sun's help to debug this. Normally I would regenerate JVM.DLL with debugging symbols under VC++ but the source-codes do not ship with a project-file and I am not about to generate one from scratch as it will take a very very long time.

Can a Sun engineer please work with me to zero in on the cause of the crash? Shipping me a version of jvm.dll with debug symbols should be enough for me to get back a line number in the JDK source-codes and send an explanation for the cause of the crash back to Sun.


REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
Link statically against JVM
(Incident Review ID: 282242) 
======================================================================

Comments
EVALUATION Gili - Thank you for reporting this problem. Could you possibly provide a bit more information and try a couple of things for us? First - a clarification please: does this fail with both 1.4.2_b04 and 1.5.0 beta2 b51? It sounds as though you have done very careful experimentation. Just to be sure though - do you get any errors from LoadLibrary(), GetProcAddress(), or JVM_CreateJavaVM()? Could you please try a couple of tests for us and let us know the results? 1) Could you please create the JVM with -XX:+UseDefaultStackSize as an argument? 2) Could you please create the JVM with -Xss256k (or feel free to experiment with other stack size values) 3) Could you please try our latest beta version in case the problem is running out of (non-stack) memory and let us know if you are possibly getting an error back from the JNI_CreateJavaVM() call? You can get the latest beta version on http://java.sun.com/j2se/1.5.0/snapshots
23-07-2004