From f488964d6725d7c3302d7b4316143b897ca04f8a Mon Sep 17 00:00:00 2001 From: xlu Date: Fri, 15 Aug 2008 10:08:20 -0700 Subject: [PATCH] 6608862: segv in JvmtiEnvBase::check_for_periodic_clean_up() Reviewed-by: dholmes, dcubed, jcoomes --- src/share/vm/runtime/thread.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/share/vm/runtime/thread.cpp b/src/share/vm/runtime/thread.cpp index 85919814b..5a09f774b 100644 --- a/src/share/vm/runtime/thread.cpp +++ b/src/share/vm/runtime/thread.cpp @@ -2756,7 +2756,13 @@ void Threads::threads_do(ThreadClosure* tc) { // For now, just manually iterate through them. tc->do_thread(VMThread::vm_thread()); Universe::heap()->gc_threads_do(tc); - tc->do_thread(WatcherThread::watcher_thread()); + { + // Grab the Terminator_lock to prevent watcher_thread from being terminated. + MutexLockerEx mu(Terminator_lock, Mutex::_no_safepoint_check_flag); + WatcherThread *wt = WatcherThread::watcher_thread(); + if (wt != NULL) + tc->do_thread(wt); + } // If CompilerThreads ever become non-JavaThreads, add them here } -- GitLab