diff -r a7d850b47b19 -r 6a21dba79b81 src/hotspot/share/jfr/leakprofiler/leakProfiler.cpp --- a/src/hotspot/share/jfr/leakprofiler/leakProfiler.cpp Sat Oct 26 23:59:51 2019 +0200 +++ b/src/hotspot/share/jfr/leakprofiler/leakProfiler.cpp Mon Oct 28 18:43:04 2019 +0100 @@ -31,6 +31,7 @@ #include "jfr/recorder/service/jfrOptionSet.hpp" #include "logging/log.hpp" #include "memory/iterator.hpp" +#include "runtime/mutexLocker.hpp" #include "runtime/thread.inline.hpp" #include "runtime/vmThread.hpp" @@ -92,6 +93,7 @@ if (!is_running()) { return; } + MutexLocker lock(JfrStream_lock); // exclusive access to object sampler instance ObjectSampler* const sampler = ObjectSampler::acquire(); assert(sampler != NULL, "invariant");