Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node_mksnapshot fails for debug builds #294

Open
targos opened this issue Dec 19, 2024 · 5 comments · May be fixed by nodejs/node#56327
Open

node_mksnapshot fails for debug builds #294

targos opened this issue Dec 19, 2024 · 5 comments · May be fixed by nodejs/node#56327

Comments

@targos
Copy link
Member

targos commented Dec 19, 2024

Using https://github.com/nodejs/node/tree/canary-base

./configure --ninja --debug
ninja -C out/Debug

/cc @nodejs/cpp-reviewers

FAILED: gen/node_snapshot.cc
cd ../../; export BUILT_FRAMEWORKS_DIR=/Users/mzasso/git/nodejs/canary/out/Debug; export BUILT_PRODUCTS_DIR=/Users/mzasso/git/nodejs/canary/out/Debug; export CONFIGURATION=Debug; export EXECUTABLE_NAME=node; export EXECUTABLE_PATH=node; export FULL_PRODUCT_NAME=node; export PRODUCT_NAME=node; export PRODUCT_TYPE=com.apple.product-type.tool; export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk; export SRCROOT=/Users/mzasso/git/nodejs/canary/out/Debug/../../; export SOURCE_ROOT="${SRCROOT}"; export TARGET_BUILD_DIR=/Users/mzasso/git/nodejs/canary/out/Debug; export TEMP_DIR="${TMPDIR}"; export XCODE_VERSION_ACTUAL=1620;/Users/mzasso/git/nodejs/canary/out/Debug/node_mksnapshot /Users/mzasso/git/nodejs/canary/out/Debug/gen/node_snapshot.cc


#
# Fatal error in ../../deps/v8/src/heap/cppgc/prefinalizer-handler.cc, line 54
# Debug check failed: CurrentThreadIsCreationThread().
#
#
#
#FailureMessage Object: 0x16f709528
----- Native stack trace -----

 1: 0x100e9f5b4 node::DumpNativeBacktrace(__sFILE*) [/Users/mzasso/git/nodejs/canary/out/Debug/node_mksnapshot]
 2: 0x1011121d0 node::NodePlatform::GetStackTracePrinter()::$_0::operator()() const [/Users/mzasso/git/nodejs/canary/out/Debug/node_mksnapshot]
 3: 0x10111218c node::NodePlatform::GetStackTracePrinter()::$_0::__invoke() [/Users/mzasso/git/nodejs/canary/out/Debug/node_mksnapshot]
 4: 0x10331a378 V8_Fatal(char const*, int, char const*, ...) [/Users/mzasso/git/nodejs/canary/out/Debug/node_mksnapshot]
 5: 0x103319ce4 v8::base::SetFatalFunction(void (*)(char const*, int, char const*)) [/Users/mzasso/git/nodejs/canary/out/Debug/node_mksnapshot]
 6: 0x103302edc cppgc::internal::PreFinalizerHandler::InvokePreFinalizers() [/Users/mzasso/git/nodejs/canary/out/Debug/node_mksnapshot]
 7: 0x1032f2c0c cppgc::internal::HeapBase::ExecutePreFinalizers() [/Users/mzasso/git/nodejs/canary/out/Debug/node_mksnapshot]
 8: 0x101f81cfc v8::internal::CppHeap::CompactAndSweep() [/Users/mzasso/git/nodejs/canary/out/Debug/node_mksnapshot]
 9: 0x1020577a4 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::internal::GarbageCollectionReason, char const*) [/Users/mzasso/git/nodejs/canary/out/Debug/node_mksnapshot]
10: 0x102072cd8 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags)::$_1::operator()() const [/Users/mzasso/git/nodejs/canary/out/Debug/node_mksnapshot]
11: 0x102072818 void heap::base::Stack::SetMarkerAndCallbackImpl<v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags)::$_1>(heap::base::Stack*, void*, void const*) [/Users/mzasso/git/nodejs/canary/out/Debug/node_mksnapshot]
12: 0x1032e68ec PushAllRegistersAndIterateStack [/Users/mzasso/git/nodejs/canary/out/Debug/node_mksnapshot]
13: 0x102051c64 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/Users/mzasso/git/nodejs/canary/out/Debug/node_mksnapshot]
14: 0x1020528d8 v8::internal::Heap::CollectAllAvailableGarbage(v8::internal::GarbageCollectionReason) [/Users/mzasso/git/nodejs/canary/out/Debug/node_mksnapshot]
15: 0x10294aa48 v8::internal::SnapshotCreatorImpl::CreateBlob(v8::SnapshotCreator::FunctionCodeHandling, v8::base::Flags<v8::internal::Snapshot::SerializerFlag, int, int>) [/Users/mzasso/git/nodejs/canary/out/Debug/node_mksnapshot]
16: 0x10116c3a4 node::SnapshotBuilder::CreateSnapshot(node::SnapshotData*, node::CommonEnvironmentSetup*) [/Users/mzasso/git/nodejs/canary/out/Debug/node_mksnapshot]
17: 0x10116bbb8 node::BuildSnapshotWithoutCodeCache(node::SnapshotData*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, std::__1::optional<std::__1::basic_string_view<char, std::__1::char_traits<char>>>, node::SnapshotConfig const&) [/Users/mzasso/git/nodejs/canary/out/Debug/node_mksnapshot]
18: 0x10116cbdc node::SnapshotBuilder::Generate(node::SnapshotData*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, std::__1::optional<std::__1::basic_string_view<char, std::__1::char_traits<char>>>, node::SnapshotConfig const&) [/Users/mzasso/git/nodejs/canary/out/Debug/node_mksnapshot]
19: 0x10116d7fc node::SnapshotBuilder::GenerateAsSource(char const*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, node::SnapshotConfig const&, bool) [/Users/mzasso/git/nodejs/canary/out/Debug/node_mksnapshot]
20: 0x100d5a4c8 BuildSnapshot(int, char**) [/Users/mzasso/git/nodejs/canary/out/Debug/node_mksnapshot]
21: 0x100d5a220 main [/Users/mzasso/git/nodejs/canary/out/Debug/node_mksnapshot]
22: 0x19c5c8274 start [/usr/lib/dyld]
/bin/sh: line 1: 74460 Trace/BPT trap: 5       /Users/mzasso/git/nodejs/canary/out/Debug/node_mksnapshot /Users/mzasso/git/nodejs/canary/out/Debug/gen/node_snapshot.cc
@joyeecheung
Copy link
Member

From a quick glance it looks like a bogus assertion - it should be invoked on the main thread where the cppgc heap is created. I'll debug a bit and see what's happening.

@joyeecheung
Copy link
Member

By the way I can't seem to build canary-base with Clang 14 on macOS 13, which throws up at

../../deps/v8/src/heap/heap-visitor.h:199:32: error: no member named 'UsePrecomputedObjectSize' in 'v8::internal::YoungGenerationMarkingVisitor<v8::internal::YoungGenerationMarkingVisitationMode::kParallel>'
    requires(!ConcreteVisitor::UsePrecomputedObjectSize());
              ~~~~~~~~~~~~~~~~~^

I think this might be a bug in Clang 14 with requires, maybe switching it to enable_if would make it work..

@joyeecheung
Copy link
Member

I managed to build it after applying a lot of local fixes (C++ new feature workarounds, mostly) for Clang 14. The DCHECK is caused by not locking the isolate, fix in nodejs/node#56327

@joyeecheung
Copy link
Member

FYI, I put the local fixes to make canary-base build on macOS + Apple 14 in https://github.com/joyeecheung/node/tree/fix-macos-13

@targos
Copy link
Member Author

targos commented Dec 21, 2024

Thanks, I added the commit to canary-base

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants