diff --git a/deps/v8/src/isolate.h b/deps/v8/src/isolate.h index 9ef6fc732a9f..ca3dfb8bdeda 100644 --- a/deps/v8/src/isolate.h +++ b/deps/v8/src/isolate.h @@ -384,6 +384,11 @@ class Isolate { public: ~Isolate(); + // ISSUE-14576: allow to access process_wide_mutex_ from sampler.cc + static base::LazyMutex GetProcessWideMutex() { + return process_wide_mutex_; + } + // A thread has a PerIsolateThreadData instance for each isolate that it has // entered. That instance is allocated when the isolate is initially entered // and reused on subsequent entries. diff --git a/deps/v8/src/sampler.cc b/deps/v8/src/sampler.cc index 0be31b51b08d..e9ad8a7ddb0a 100644 --- a/deps/v8/src/sampler.cc +++ b/deps/v8/src/sampler.cc @@ -342,6 +342,15 @@ void SignalHandler::HandleProfilerSignal(int signal, siginfo_t* info, // We require a fully initialized and entered isolate. return; } + + // ISSUE-14576: To avoid deadlock, return if there is a thread lock + if (Isolate::GetProcessWideMutex().Pointer()->TryLock()) { + Isolate::GetProcessWideMutex().Pointer()->Unlock(); + } + else { + return; + } + if (v8::Locker::IsActive() && !isolate->thread_manager()->IsLockedByCurrentThread()) { return;