Disable JVM from handling hard errors

Christian Törnqvist christian.tornqvist at oracle.com
Thu Aug 25 08:09:21 PDT 2011


There should be an exception context record stored in the minidump which should put you in the correct context. When loaded in windbg, use the command '.ecxr' to set the context to the exception context record.

Regards,
Christian

-----Original Message-----
From: Huang, Baiyan [mailto:Baiyan.Huang at morganstanley.com] 
Sent: den 25 augusti 2011 16:17
To: David Holmes
Cc: hotspot-dev at openjdk.java.net
Subject: RE: Disable JVM from handling hard errors

Thanks David,

But what if I don't have the permission to change the JNI code?

Actually, even I can change the JNI code, and I install my exception handler, it also "handle" the exception, and the execution flow is jump to other place, rather than the "crash" point. -XX:CreateMinidumpOnCrash should be similar as it also requires a exception handler.

I am thinking of away to disable the internal handling in JVM of such exception.

-Baiyan

   
-----Original Message-----
From: David Holmes [mailto:David.Holmes at oracle.com] 
Sent: Thursday, August 25, 2011 6:32 PM
To: Huang, Baiyan (ISGT)
Cc: hotspot-dev at openjdk.java.net
Subject: Re: Disable JVM from handling hard errors

On 25/08/2011 7:56 PM, Huang, Baiyan wrote:
> Suppose I have a simple JNI program in Windows:
>
> int* p = NULL;
>
> *p = 5;
>
> When run it from JVM, not like normal C++ application, JVM will nicely catch
> such hard exception and do some cleanup work.
>
> The problem here is it also stops me from generating crash dumps right
> there, although there is a JVM option: -XX:OnError, but core dumps generated
> at this point is far from the crime scene thus hard to debug.
>
> Do you have any suggestions?

I think you'd need to install your own fatal exception handler whilst in the 
JNI code, and restore the JVM handler when leaving. I'm not sure of the 
details on Windows in terms of API.

But the JVM fatal error handling can create a crash dump - use 
-XX:CreateMinidumpOnCrash

David

> Thanks.
>
> -Baiyan
>
> ----------------------------------------------------------------------------
> NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions
> or views contained herein are not intended to be, and do not constitute,
> advice within the meaning of Section 975 of the Dodd-Frank Wall Street
> Reform and Consumer Protection Act. If you have received this communication
> in error, please destroy all electronic and paper copies and notify the
> sender immediately. Mistransmission is not intended to waive confidentiality
> or privilege. Morgan Stanley reserves the right, to the extent permitted
> under applicable law, to monitor electronic communications. This message is
> subject to terms available at the following link:
> http://www.morganstanley.com/disclaimers. If you cannot access these links,
> please notify us by reply message and we will send the contents to you. By
> messaging with Morgan Stanley you consent to the foregoing.

--------------------------------------------------------------------------
NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or views contained herein are not intended to be, and do not constitute, advice within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and Consumer Protection Act. If you have received this communication in error, please destroy all electronic and paper copies and notify the sender immediately. Mistransmission is not intended to waive confidentiality or privilege. Morgan Stanley reserves the right, to the extent permitted under applicable law, to monitor electronic communications. This message is subject to terms available at the following link: http://www.morganstanley.com/disclaimers. If you cannot access these links, please notify us by reply message and we will send the contents to you. By messaging with Morgan Stanley you consent to the foregoing.


More information about the hotspot-dev mailing list