--- old/src/hotspot/share/trace/tracingExport.cpp 2018-04-11 10:52:07.000000000 -0400 +++ new/src/hotspot/share/trace/tracingExport.cpp 2018-04-11 10:52:07.000000000 -0400 @@ -36,5 +36,7 @@ void TracingExport::set_sampler_thread_with_lock(Thread* thread) { // Grab Threads_lock to avoid conflicts with Thread-SMR scans. MutexLocker ml(Threads_lock); - _sampler_thread = thread; + assert(thread == NULL || _sampler_thread == NULL, "_sampler_thread should not already be set."); + // To match with the lock-free load_acquire(): + OrderAccess::release_store(&_sampler_thread, thread); }