diff --git a/node.gyp b/node.gyp index 726403ae0bb9f4..6397deea9af503 100644 --- a/node.gyp +++ b/node.gyp @@ -834,6 +834,7 @@ 'deps/googletest/googletest.gyp:gtest_prod', 'deps/histogram/histogram.gyp:histogram', 'deps/nbytes/nbytes.gyp:nbytes', + 'tools/v8_gypfiles/abseil.gyp:abseil', 'node_js2c#host', ], @@ -1159,6 +1160,7 @@ 'deps/googletest/googletest.gyp:gtest_main', 'deps/histogram/histogram.gyp:histogram', 'deps/nbytes/nbytes.gyp:nbytes', + 'tools/v8_gypfiles/abseil.gyp:abseil', ], 'includes': [ diff --git a/src/node.cc b/src/node.cc index dfe223b51dc767..9f41dc84340ae0 100644 --- a/src/node.cc +++ b/src/node.cc @@ -119,6 +119,8 @@ #include // STDIN_FILENO, STDERR_FILENO #endif +#include "absl/synchronization/mutex.h" + // ========== global C++ headers ========== #include @@ -1211,6 +1213,11 @@ InitializeOncePerProcessInternal(const std::vector& args, if (!(flags & ProcessInitializationFlags::kNoInitializeV8)) { V8::Initialize(); + + // Disable absl deadlock detection in V8 as it reports false-positive cases. + // TODO(legendecas): Replace this global disablement with case suppressions. + // https://github.com/nodejs/node-v8/issues/301 + absl::SetMutexDeadlockDetectionMode(absl::OnDeadlockCycle::kIgnore); } if (!(flags & ProcessInitializationFlags::kNoInitializeCppgc)) { diff --git a/test/cctest/node_test_fixture.cc b/test/cctest/node_test_fixture.cc index d2662604d14ae9..cae9c7b76aee88 100644 --- a/test/cctest/node_test_fixture.cc +++ b/test/cctest/node_test_fixture.cc @@ -1,4 +1,5 @@ #include "node_test_fixture.h" +#include "absl/synchronization/mutex.h" #include "cppgc/platform.h" ArrayBufferUniquePtr NodeZeroIsolateTestFixture::allocator{nullptr, nullptr}; @@ -31,6 +32,11 @@ void NodeTestEnvironment::SetUp() { v8::V8::SetFlagsFromString("--no-freeze-flags-after-init"); v8::V8::Initialize(); + + // Disable absl deadlock detection in V8 as it reports false-positive cases. + // TODO(legendecas): Replace this global disablement with case suppressions. + // https://github.com/nodejs/node-v8/issues/301 + absl::SetMutexDeadlockDetectionMode(absl::OnDeadlockCycle::kIgnore); } void NodeTestEnvironment::TearDown() { diff --git a/tools/v8_gypfiles/abseil.gyp b/tools/v8_gypfiles/abseil.gyp index 1dd01f7f2fad36..c5d4676cc370b1 100644 --- a/tools/v8_gypfiles/abseil.gyp +++ b/tools/v8_gypfiles/abseil.gyp @@ -277,6 +277,8 @@ '<(ABSEIL_ROOT)/absl/synchronization/internal/waiter.h', '<(ABSEIL_ROOT)/absl/synchronization/internal/waiter_base.h', '<(ABSEIL_ROOT)/absl/synchronization/internal/waiter_base.cc', + '<(ABSEIL_ROOT)/absl/synchronization/internal/win32_waiter.h', + '<(ABSEIL_ROOT)/absl/synchronization/internal/win32_waiter.cc', '<(ABSEIL_ROOT)/absl/synchronization/mutex.h', '<(ABSEIL_ROOT)/absl/synchronization/mutex.cc', '<(ABSEIL_ROOT)/absl/time/civil_time.h',