RFR(xxs): 8213236: A partial removed/deleted JavaThread cannot transition

Erik Österlund erik.osterlund at oracle.com
Thu Nov 1 13:53:23 UTC 2018


Hi Robbin,

Looks good.

Thanks,
/Erik

On 2018-11-01 12:57, Robbin Ehn wrote:
> Hi all please review,
>
> In 8212933 we moved the cancellation of a handshake to the VM thread, 
> for sanity
> an assert was added to make sure the JavaThread do not cancel. 
> (technically this
> works also, but to keep a simple model it should be done by the VM 
> thread)
>
> A JavaThread that is terminated but not yet free should not follow the 
> safepoint
> protocol. Since the VM thread running the safepoint cannot see such a 
> thread
> it's confusing and error-prone doing safepoint checks and transitions 
> from a
> thread not 'attached' to the VM.
>
> Issue:
> https://bugs.openjdk.java.net/browse/JDK-8213236
>
> Code:
> diff -r 13ad2bfee99e src/hotspot/share/runtime/vmThread.cpp
> --- a/src/hotspot/share/runtime/vmThread.cpp    Thu Nov 01 09:57:57 
> 2018 +0100
> +++ b/src/hotspot/share/runtime/vmThread.cpp    Thu Nov 01 12:40:47 
> 2018 +0100
> @@ -319,7 +319,9 @@
>  // Notify the VMThread that the last non-daemon JavaThread has 
> terminated,
>  // and wait until operation is performed.
>  void VMThread::wait_for_vm_thread_exit() {
> -  { MutexLocker mu(VMOperationQueue_lock);
> +  assert(Thread::current()->is_Java_thread(), "Should be a JavaThread");
> +  assert(((JavaThread*)Thread::current())->is_terminated(), "Should 
> be off threadslist");
> +  { MutexLockerEx mu(VMOperationQueue_lock, 
> Mutex::_no_safepoint_check_flag);
>      _should_terminate = true;
>      VMOperationQueue_lock->notify();
>    }
>
> Passes t1-2.
>
> Thanks Robbin



More information about the hotspot-runtime-dev mailing list