--- old/src/hotspot/share/utilities/vmError.cpp 2019-11-01 17:03:44.941450800 +0900 +++ new/src/hotspot/share/utilities/vmError.cpp 2019-11-01 17:03:44.357959700 +0900 @@ -1415,8 +1415,19 @@ e.commit(); } - JFR_ONLY(Jfr::on_vm_shutdown(true);) - +#ifdef INCLUDE_JFR + // JFR emergency dump would transit thread state to "_thread_in_vm". + // We need to recover it after dumping. + JavaThreadState orig_thread_state = _thread_max_state; + if (thread && thread->is_Java_thread()) { + JavaThread* jt = (JavaThread*)thread; + orig_thread_state = jt->thread_state(); + } + Jfr::on_vm_shutdown(true); + if (orig_thread_state != _thread_max_state) { + ((JavaThread*)thread)->set_thread_state(orig_thread_state); + } +#endif } else { // If UseOsErrorReporting we call this for each level of the call stack // while searching for the exception handler. Only the first level needs