From 6b1b0e9d45eb56f88398e2a6bca0d90c03112eaa Mon Sep 17 00:00:00 2001 From: Andrei Pangin Date: Tue, 2 Apr 2024 04:30:26 +0000 Subject: [PATCH] 8329103: assert(!thread->in_asgct()) failed during multi-mode profiling Reviewed-by: dholmes, sspitsyn --- src/hotspot/share/runtime/thread.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/hotspot/share/runtime/thread.hpp b/src/hotspot/share/runtime/thread.hpp index 7461876f378..32f7b7fa8ec 100644 --- a/src/hotspot/share/runtime/thread.hpp +++ b/src/hotspot/share/runtime/thread.hpp @@ -657,15 +657,17 @@ protected: class ThreadInAsgct { private: Thread* _thread; + bool _saved_in_asgct; public: ThreadInAsgct(Thread* thread) : _thread(thread) { assert(thread != nullptr, "invariant"); - assert(!thread->in_asgct(), "invariant"); + // Allow AsyncGetCallTrace to be reentrant - save the previous state. + _saved_in_asgct = thread->in_asgct(); thread->set_in_asgct(true); } ~ThreadInAsgct() { assert(_thread->in_asgct(), "invariant"); - _thread->set_in_asgct(false); + _thread->set_in_asgct(_saved_in_asgct); } };