[jdk8u-dev] RFR: 8074860: Structured Exception Catcher missing around CreateJavaVM on Windows

Thomas Stuefe stuefe at openjdk.org
Tue Feb 20 19:57:57 UTC 2024


On Tue, 20 Feb 2024 18:31:41 GMT, Frederic Thevenet <fthevenet at openjdk.org> wrote:

> Hi,
> 
> This is a backport of [JDK-8082592](https://bugs.openjdk.org/browse/JDK-8082592) which adds Structured Exception Handling (SEH) to guard 'JNI_CreateJavaVM' on Windows.
> 
> The motivation for this backport is to help reduce the number of occurences where a VM might crash will terminate VM immediately without writing an error log Windows, making root cause analysis very difficult in such cases.
> 
> In addition, I plan to also backport [JDK-8186199](https://bugs.openjdk.org/browse/JDK-8186199) as a follow-up, which does something similar to guard 'JNI_DestroyJavaVM'.
> 
> Thanks!

Hi Frederic,

It looks okay.

If we have the time, to be sure, could you please do the following test: apply the following patch:


diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp
index e6586c40cb..7fc4efbb0b 100644
--- a/hotspot/src/share/vm/runtime/thread.cpp
+++ b/hotspot/src/share/vm/runtime/thread.cpp
@@ -3329,6 +3329,8 @@ void Threads::threads_do(ThreadClosure* tc) {
   // If CompilerThreads ever become non-JavaThreads, add them here
 }
 
+volatile char* AAAA = NULL;
+
 jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
 
   extern void JDK_Version_init();
@@ -3503,6 +3505,11 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
     ShouldNotReachHere();
   }
 
+
+  if (UseNewCode) {
+    (*AAAA) = 'A';
+  }
+
   // Always call even when there are not JVMTI environments yet, since environments
   // may be attached late and JVMTI must track phases of VM execution
   JvmtiExport::enter_start_phase();


and run this without and without this backport.

Then test this by running  `java -XX:+UnlockDiagnosticVMOptions -XX:+UseNewCode -version`

I expect:
- without the backport: a "silent-like" crash without a hs-err file
- with the backport: a crash with a hs-err file

Then we know for sure this works. Thank you!

-------------

PR Comment: https://git.openjdk.org/jdk8u-dev/pull/449#issuecomment-1954954778


More information about the jdk8u-dev mailing list