Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Silent access violations inside JVM

843829Dec 7 2005 — edited Dec 16 2005
I am using JDK 1.5.0_05 on Windows XP and 2003, and have noticed that jvm.dll quietly throws access violation and occassional illegal instruction exceptions and somehow handles them internally without reporting a problem to the user. These are hardware exceptions that I had thought would terminate the process and produce an error log file.

I discovered the problem in my own JNI application. I am writing a C++ application that launches a JVM through the JNI invocation API. Occassionally, the embedded JVM in my application throws access violation exceptions from deep inside jvm.dll. These exceptions bubble up the stack and my C++ application reports them.

After struggling to find the error in my own app, I decided to examine a few other java applications. I found that the JVM silently throws similar exceptions for other applications that I've always run without problems.

You can reproduce this problem with a Windows debugger and any sizable java application. I've used Visual Studio 2003 as the debugger and Eclipse as the test application to reproduce this. Here's what to do:
1. Start your test java application, such as Eclipse.
2. Start your Windows debugger, such as Visual Studio 2003.
3. Configure your debugger to trap all Win32 exceptions. In VS 2003, select "Exceptions" from the "Debug" menu, then highlight "Win32 Exceptions" and check the "Break into the debugger" radio button under the "When the exception is thrown" section. Click the OK button.
4. Attach your debugger to the running java.exe or javaw.exe process. In VS 2003, select "Debug Process" from the "Tools" menu. Attach to the java.exe or javaw.exe process.
5. In your java application which is now being debugged at the OS level, do some CPU and memory intensive operation. In Eclipse, you may want to try a full rebuild of a sizable java project.

When I go through this process, VS 2003 traps illegal operation exceptions and sometimes access violations from javaw.exe, which is the same behavior I saw in my application. I've reproduced this problem on three different machines. One runs Windows XP and the other two run Windows 2003 server. I also tried running with JRE 1.5.0_04 and saw the same problem.

Does anyone have any idea what is going on here?

Since the JVM running eclipse seems to handle these hardware exceptions and keep running, I'm configuring my JNI application to ignore all access violations and keep going using Windows SEH. Is this a reasonable thing to do?


Thank you
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 13 2006
Added on Dec 7 2005
3 comments
663 views