# HG changeset patch # User igerasim # Date 1408663956 25200 # Node ID 6a9d9192f215638a282ba26f286f77996c6301d9 # Parent ff1a31478531e6e82574947b914ad9e882934b2a 8055338: (process) Add instrumentation to help diagnose JDK-6573254 Reviewed-by: dcubed, ohair, iklam, dholmes, sspitsyn, sla diff -r ff1a31478531 -r 6a9d9192f215 hotspot/src/os/windows/vm/os_windows.cpp --- a/hotspot/src/os/windows/vm/os_windows.cpp Thu Aug 21 01:43:27 2014 +0000 +++ b/hotspot/src/os/windows/vm/os_windows.cpp Thu Aug 21 16:32:36 2014 -0700 @@ -409,6 +409,8 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo); +extern jint volatile vm_getting_terminated; + // Thread start routine for all new Java threads static unsigned __stdcall java_start(Thread* thread) { // Try to randomize the cache line index of hot stack frames. @@ -430,9 +432,17 @@ } } + // Diagnostic code to investigate JDK-6573254 (Part I) + unsigned res = 90115; // non-java thread + if (thread->is_Java_thread()) { + JavaThread* java_thread = (JavaThread*)thread; + res = java_lang_Thread::is_daemon(java_thread->threadObj()) + ? 70115 // java daemon thread + : 80115; // java non-daemon thread + } // Install a win32 structured exception handler around every thread created - // by VM, so VM can genrate error dump when an exception occurred in non- + // by VM, so VM can generate error dump when an exception occurred in non- // Java thread (e.g. VM thread). __try { thread->run(); @@ -448,6 +458,11 @@ Atomic::dec_ptr((intptr_t*)&os::win32::_os_thread_count); } + // Diagnostic code to investigate JDK-6573254 (Part II) + if (OrderAccess::load_acquire(&vm_getting_terminated)) { + return res; + } + return 0; } diff -r ff1a31478531 -r 6a9d9192f215 hotspot/src/share/vm/runtime/java.cpp --- a/hotspot/src/share/vm/runtime/java.cpp Thu Aug 21 01:43:27 2014 +0000 +++ b/hotspot/src/share/vm/runtime/java.cpp Thu Aug 21 16:32:36 2014 -0700 @@ -430,6 +430,8 @@ } } +jint volatile vm_getting_terminated = 0; + // Note: before_exit() can be executed only once, if more than one threads // are trying to shutdown the VM at the same time, only one thread // can run before_exit() and all other threads must wait. @@ -460,6 +462,8 @@ } } + OrderAccess::release_store(&vm_getting_terminated, 1); + // The only difference between this and Win32's _onexit procs is that // this version is invoked before any threads get killed. ExitProc* current = exit_procs;