Skip to content

[help wanted] deps: update V8 to 13.6 #57753

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

Open
wants to merge 43 commits into
base: main
Choose a base branch
from
Open

[help wanted] deps: update V8 to 13.6 #57753

wants to merge 43 commits into from

Conversation

targos
Copy link
Member

@targos targos commented Apr 5, 2025

I hope it can replace #57114

Notable changes:

@nodejs/v8-update @nodejs/tsc

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/gyp
  • @nodejs/security-wg
  • @nodejs/tsc
  • @nodejs/v8-update

@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to build files or the CI. dependencies Pull requests that update a dependency file. meta Issues and PRs related to the general management of the project. needs-ci PRs that need a full CI run. v8 engine Issues and PRs related to the V8 dependency. labels Apr 5, 2025
@targos
Copy link
Member Author

targos commented Apr 5, 2025

@joyeecheung (or maybe someone else from @nodejs/cpp-reviewers) Can you help finalizing 05eab64 ?
I ported all the referenced PRs from #52718 but there is an issue with node_mksnapshot:

[1903/1919] ACTION node: node_mksnapshot_9b7a2d2290b02e76d66661df74749f56
FAILED: gen/node_snapshot.cc
cd ../../; export BUILT_FRAMEWORKS_DIR=/Users/mzasso/git/nodejs/v8-next-update/out/Debug; export BUILT_PRODUCTS_DIR=/Users/mzasso/git/nodejs/v8-next-update/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/v8-next-update/out/Debug/../../; export SOURCE_ROOT="${SRCROOT}"; export TARGET_BUILD_DIR=/Users/mzasso/git/nodejs/v8-next-update/out/Debug; export TEMP_DIR="${TMPDIR}"; export XCODE_VERSION_ACTUAL=1630;/Users/mzasso/git/nodejs/v8-next-update/out/Debug/node_mksnapshot /Users/mzasso/git/nodejs/v8-next-update/out/Debug/gen/node_snapshot.cc

  #  /Users/mzasso/git/nodejs/v8-next-update/out/Debug/node_mksnapshot[39108]: IsolatePlatformDelegate *node::NodePlatform::ForIsolate(Isolate *) at ../../src/node_platform.cc:530
  #  Assertion failed: (data.first) != nullptr

----- Native stack trace -----

 1: 0x104f36d9c node::DumpNativeBacktrace(__sFILE*) [/Users/mzasso/git/nodejs/v8-next-update/out/Debug/node_mksnapshot]
 2: 0x1050a0e5c node::Assert(node::AssertionInfo const&) [/Users/mzasso/git/nodejs/v8-next-update/out/Debug/node_mksnapshot]
 3: 0x10519b9a4 node::NodePlatform::ForIsolate(v8::Isolate*) [/Users/mzasso/git/nodejs/v8-next-update/out/Debug/node_mksnapshot]
 4: 0x10519bcec node::NodePlatform::GetForegroundTaskRunner(v8::Isolate*, v8::TaskPriority) [/Users/mzasso/git/nodejs/v8-next-update/out/Debug/node_mksnapshot]
 5: 0x106ffd978 cppgc::internal::Sweeper::SweeperImpl::Start(cppgc::internal::SweepingConfig) [/Users/mzasso/git/nodejs/v8-next-update/out/Debug/node_mksnapshot]
 6: 0x106feda98 cppgc::internal::HeapBase::Terminate() [/Users/mzasso/git/nodejs/v8-next-update/out/Debug/node_mksnapshot]
 7: 0x1060c52d0 v8::internal::CppHeap::~CppHeap() [/Users/mzasso/git/nodejs/v8-next-update/out/Debug/node_mksnapshot]
 8: 0x1060c5368 non-virtual thunk to v8::internal::CppHeap::~CppHeap() [/Users/mzasso/git/nodejs/v8-next-update/out/Debug/node_mksnapshot]
 9: 0x10613ba18 v8::internal::Heap::TearDown() [/Users/mzasso/git/nodejs/v8-next-update/out/Debug/node_mksnapshot]
10: 0x1060382d8 v8::internal::Isolate::Deinit() [/Users/mzasso/git/nodejs/v8-next-update/out/Debug/node_mksnapshot]
11: 0x106037dbc v8::internal::Isolate::Delete(v8::internal::Isolate*) [/Users/mzasso/git/nodejs/v8-next-update/out/Debug/node_mksnapshot]
12: 0x105325a74 node::RAIIIsolateWithoutEntering::~RAIIIsolateWithoutEntering() [/Users/mzasso/git/nodejs/v8-next-update/out/Debug/node_mksnapshot]
13: 0x105325aa8 node::RAIIIsolateWithoutEntering::~RAIIIsolateWithoutEntering() [/Users/mzasso/git/nodejs/v8-next-update/out/Debug/node_mksnapshot]
14: 0x105325b60 node::RAIIIsolate::~RAIIIsolate() [/Users/mzasso/git/nodejs/v8-next-update/out/Debug/node_mksnapshot]
15: 0x105325b8c node::RAIIIsolate::~RAIIIsolate() [/Users/mzasso/git/nodejs/v8-next-update/out/Debug/node_mksnapshot]
16: 0x1051fdf20 node::BuildCodeCacheFromSnapshot(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&) [/Users/mzasso/git/nodejs/v8-next-update/out/Debug/node_mksnapshot]
17: 0x1051fe2c4 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/v8-next-update/out/Debug/node_mksnapshot]
18: 0x1051fedac 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/v8-next-update/out/Debug/node_mksnapshot]
19: 0x104e2c4bc BuildSnapshot(int, char**) [/Users/mzasso/git/nodejs/v8-next-update/out/Debug/node_mksnapshot]
20: 0x104e2c220 main [/Users/mzasso/git/nodejs/v8-next-update/out/Debug/node_mksnapshot]
21: 0x1943c6b4c start [/usr/lib/dyld]
/bin/sh: line 1: 39108 Abort trap: 6           /Users/mzasso/git/nodejs/v8-next-update/out/Debug/node_mksnapshot /Users/mzasso/git/nodejs/v8-next-update/out/Debug/gen/node_snapshot.cc

@targos targos marked this pull request as draft April 5, 2025 09:11
@targos targos added the semver-major PRs that contain breaking changes and should be released in the next major version. label Apr 5, 2025
@targos targos force-pushed the v8-136 branch 2 times, most recently from e1ed931 to 7774826 Compare April 6, 2025 11:15
@targos targos changed the title deps: update V8 to 13.6 [help wanted] deps: update V8 to 13.6 Apr 6, 2025
@targos targos added the help wanted Issues that need assistance from volunteers or PRs that need help to proceed. label Apr 6, 2025
@danmcd
Copy link

danmcd commented Apr 6, 2025

I will run a build on illumos/SmartOS. If you fixed the JSDispatchEntry assumptions about high-16-bits in kFreeEntryTag that'll help out a lot.

@danmcd
Copy link

danmcd commented Apr 7, 2025

I will run a build on illumos/SmartOS. If you fixed the JSDispatchEntry assumptions about high-16-bits in kFreeEntryTag that'll help out a lot.

I used some brute-force to clear the high-16-bits in the userland address space so v8 can do its thing. It stopped failing where it used to and started failing somewhere else, but still in node_mksnapshot.

In non-debug/stock:

  LD_LIBRARY_PATH=/home/danmcd/targos-v8-136/out/Release/lib.host:/home/danmcd/targos-v8-136/out/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../.; mkdir -p /home/danmcd/targos-v8-136/out/Release/obj/gen; "/home/danmcd/targos-v8-136/out/Release/node_mksnapshot" "/home/danmcd/targos-v8-136/out/Release/obj/gen/node_snapshot.cc"

  #  [20437]: node::IsolatePlatformDelegate* node::NodePlatform::ForIsolate(v8::Isolate*) at ../src/node_platform.cc:530
  #  Assertion failed: (data.first) != nullptr

In debug (using --v8-non-optimized-debug --v8-with-dchecks --v8-enable-object-print) I get the same error.

I noticed on #57114 that @bnoordhuis had a suggestion too that might ease the requirement for me to do something drastic (at least in the short term?).

If v8 documents "pointer requirements" somewhere, that'd help me a lot. I'm visiting the v8-dev google group now, so they may give me the clues I need.

EDIT/UPDATE ==> I didn't look carefully before at @targos 's update ==> I'm encountering the same issue.

@targos
Copy link
Member Author

targos commented Apr 9, 2025

#57753 (comment) basically requires a revert of #30909.
I will push it so we can run CI but if the race condition is still possible I don't know what to do.

@targos
Copy link
Member Author

targos commented Apr 9, 2025

/cc @addaleax

@targos
Copy link
Member Author

targos commented Apr 9, 2025

Now it's failing embedtest:

$ out/Debug/embedtest -- 'eval((require("fs").readFileSync("test/fixtures/snapshot/echo-args.js", "utf8")))' arg1 arg2 --embedder-snapshot-blob test/.tmp.0/embedder-snapshot.blob --embedder-snapshot-create
(node:77036) Warning: It's not yet fully verified whether built-in module "vm" works in user snapshot builder scripts.
It may still work in some cases, but in other cases certain run-time states may be out-of-sync after snapshot deserialization.
To request support for the module, use the Node.js issue tracker: https://github.com/nodejs/node/issues
(Use `embedtest --trace-warnings ...` to show where the warning was created)
[1]    77036 segmentation fault  out/Debug/embedtest --  arg1 arg2 --embedder-snapshot-blob
(node:76421) Warning: It's not yet fully verified whether built-in module "vm" works in user snapshot builder scripts.
It may still work in some cases, but in other cases certain run-time states may be out-of-sync after snapshot deserialization.
To request support for the module, use the Node.js issue tracker: https://github.com/nodejs/node/issues
(Use `embedtest --trace-warnings ...` to show where the warning was created)
Process 76421 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xa8)
    frame #0: 0x000000010283dfa8 embedtest`cppgc::internal::ObjectAllocator::in_disallow_gc_scope(this=0x00000000000000a8) const at object-allocator.cc:371:10 [opt]
   368 	}
   369
   370 	bool ObjectAllocator::in_disallow_gc_scope() const {
-> 371 	  return raw_heap_.heap()->IsGCForbidden();
   372 	}
   373
   374 	#ifdef V8_ENABLE_ALLOCATION_TIMEOUT
Target 0: (embedtest) stopped.
warning: embedtest was compiled with optimization - stepping may behave oddly; variables may not be available.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xa8)
  * frame #0: 0x000000010283dfa8 embedtest`cppgc::internal::ObjectAllocator::in_disallow_gc_scope(this=0x00000000000000a8) const at object-allocator.cc:371:10 [opt]
    frame #1: 0x000000010282a25c embedtest`cppgc::internal::ObjectAllocator::AllocateObject(this=0x00000000000000a8, size=40, gcinfo=1) at object-allocator.h:113:3 [opt]
    frame #2: 0x00000001008c5cf4 embedtest`cppgc::internal::MakeGarbageCollectedTraitInternal::AllocationDispatcher<node::contextify::ContextifyScript, void, 8ul>::Invoke(handle=0x00000000000000a8, size=40) at allocation.h:93:14
    frame #3: 0x00000001008c5c8c embedtest`cppgc::MakeGarbageCollectedTraitBase<node::contextify::ContextifyScript>::Allocate(handle=0x00000000000000a8, size=40) at allocation.h:178:12
    frame #4: 0x00000001008c5c14 embedtest`node::contextify::ContextifyScript* cppgc::MakeGarbageCollectedTrait<node::contextify::ContextifyScript>::Call<node::Environment*&, v8::Local<v8::Object>&>(handle=0x00000000000000a8, args=0x000000016fdfc730, args=0x000000016fdfc738) at allocation.h:239:9
    frame #5: 0x00000001008bcd2c embedtest`node::contextify::ContextifyScript* cppgc::MakeGarbageCollected<node::contextify::ContextifyScript, node::Environment*&, v8::Local<v8::Object>&>(handle=0x00000000000000a8, args=0x000000016fdfc730, args=0x000000016fdfc738) at allocation.h:278:7
    frame #6: 0x00000001008bccf8 embedtest`node::contextify::ContextifyScript::New(env=0x000000015280c400, object=Local<v8::Object> @ 0x000000016fdfc738) at node_contextify.cc:978:10
    frame #7: 0x00000001008bbf70 embedtest`node::contextify::ContextifyScript::New(args=0x000000016fdfd018) at node_contextify.cc:1032:41
    frame #8: 0x000000010161ecd8 embedtest`v8::internal::FunctionCallbackArguments::CallOrConstruct(this=0x000000016fdfd088, function=<unavailable>, is_construct=<unavailable>) at api-arguments-inl.h:93:3 [opt]
    frame #9: 0x000000010161dfe8 embedtest`v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<true>(isolate=0x0000000158008000, new_target=DirectHandle<v8::internal::HeapObject> @ x23, fun_data=DirectHandle<v8::internal::FunctionTemplateInfo> @ x20, receiver=<unavailable>, argv=0x000000016fdfd1f8, argc=8) at builtins-api.cc:104:16 [opt]
    frame #10: 0x000000010161d260 embedtest`v8::internal::Builtin_HandleApiConstruct(int, unsigned long*, v8::internal::Isolate*) [inlined] v8::internal::Builtin_Impl_HandleApiConstruct(args=<unavailable>, isolate=0x0000000158008000) at builtins-api.cc:135:3 [opt]
    frame #11: 0x000000010161d1d0 embedtest`v8::internal::Builtin_HandleApiConstruct(args_length=<unavailable>, args_object=<unavailable>, isolate=0x0000000158008000) at builtins-api.cc:126:1 [opt]
    frame #12: 0x000000010010fe94 embedtest`Builtins_CEntry_Return1_ArgvOnStack_BuiltinExit + 84
    frame #13: 0x00000001000604f0 embedtest`Builtins_InterpreterPushArgsThenFastConstructFunction + 752
    frame #14: 0x000000010024f424 embedtest`Builtins_ConstructHandler + 1284
    frame #15: 0x000000010005fb8c embedtest`Builtins_InterpreterEntryTrampoline + 268
    frame #16: 0x00000001000603a0 embedtest`Builtins_InterpreterPushArgsThenFastConstructFunction + 416
    frame #17: 0x000000010024f424 embedtest`Builtins_ConstructHandler + 1284
    frame #18: 0x000000010005fb8c embedtest`Builtins_InterpreterEntryTrampoline + 268
    frame #19: 0x000000010005fb8c embedtest`Builtins_InterpreterEntryTrampoline + 268
    frame #20: 0x000000010005fb8c embedtest`Builtins_InterpreterEntryTrampoline + 268
    frame #21: 0x000000010005fb8c embedtest`Builtins_InterpreterEntryTrampoline + 268
    frame #22: 0x000000010005d14c embedtest`Builtins_JSEntryTrampoline + 172
    frame #23: 0x000000010005cdf0 embedtest`Builtins_JSEntry + 176
    frame #24: 0x0000000101854900 embedtest`v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [inlined] v8::internal::GeneratedCode<unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, long, unsigned long**>::Call(this=<unavailable>, args=<unavailable>, args=65939493879825, args=27756946545385, args=65939493879873, args=<unavailable>, args=0x000000016fdfdae0) at simulator.h:212:12 [opt]
    frame #25: 0x00000001018548ec embedtest`v8::internal::(anonymous namespace)::Invoke(isolate=0x0000000158008000, params=0x000000016fdfd920) at execution.cc:440:22 [opt]
    frame #26: 0x0000000101853b20 embedtest`v8::internal::Execution::Call(isolate=0x0000000158008000, callable=DirectHandle<v8::internal::Object> @ x23, receiver=DirectHandle<v8::internal::Object> @ x22, args=<unavailable>) at execution.cc:530:10 [opt]
    frame #27: 0x000000010157fd74 embedtest`v8::Function::Call(this=0x000000015284c840, isolate=0x0000000158008000, context=<unavailable>, recv=Local<v8::Value> @ x21, argc=1, argv=0x000000016fdfdae0) at api.cc:5445:7 [opt]
    frame #28: 0x00000001006cd3d0 embedtest`node::LoadEnvironment(node::Environment*, std::__1::basic_string_view<char, std::__1::char_traits<char>>, std::__1::function<void (node::Environment*, v8::Local<v8::Value>, v8::Local<v8::Value>)>)::$_0::operator()(this=0x000000016fdfdfd0, info=0x000000016fdfde88) const at environment.cc:556:30
    frame #34: 0x000000010083fa28 embedtest`std::__1::function<v8::MaybeLocal<v8::Value> (node::StartExecutionCallbackInfo const&)>::operator()(this=0x000000016fdfdfc8, __arg=0x000000016fdfde88) const at function.h:989:10
    frame #35: 0x000000010083f2d8 embedtest`node::StartExecution(env=0x000000015280c400, cb=node::StartExecutionCallback @ 0x000000016fdfdfc8) at node.cc:323:30
    frame #36: 0x00000001006c1c38 embedtest`node::LoadEnvironment(env=0x000000015280c400, cb=node::StartExecutionCallback @ 0x000000016fdfe0a8, preload=node::EmbedderPreloadCallback @ 0x000000016fdfe088) at environment.cc:542:10
    frame #37: 0x00000001006c1df8 embedtest`node::LoadEnvironment(env=0x000000015280c400, main_script_source_utf8="const assert = require('assert');assert(require('v8').startupSnapshot.isBuildingSnapshot());globalThis.embedVars = { nön_ascıı: '🏳️‍🌈' };globalThis.require = require;require('vm').runInThisContext(process.argv[2]);", preload=node::EmbedderPreloadCallback @ 0x000000016fdfe6d8) at environment.cc:551:10
    frame #38: 0x000000010066d008 embedtest`RunNodeInstance(platform=0x0000600001c401e0, args=size=7, exec_args=size=0) at embedtest.cc:189:21
    frame #39: 0x000000010066c42c embedtest`main(argc=8, raw_argv=0x000000016fdfeee0) at embedtest.cc:60:7
    frame #40: 0x00000001943c6b4c dyld`start + 600

@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Apr 9, 2025

@targos
Copy link
Member Author

targos commented Apr 9, 2025

@nodejs/platform-ppc @nodejs/platform-s390 V8 gn build fails: https://ci.nodejs.org/job/node-test-commit-v8-linux/6492/nodes=rhel8-ppc64le,v8test=v8test/console

@miladfarca
Copy link
Contributor

@targos try updating gn and build the latest.

@targos
Copy link
Member Author

targos commented Apr 9, 2025

@richardlau are you able to do that?

@richardlau
Copy link
Member

@richardlau are you able to do that?

Yes, I'll look at it after the TSC meeting.

@targos
Copy link
Member Author

targos commented Apr 9, 2025

These are the two commits that are probably wrong and I need help to fix:

  • src: adapt to V8's CppHeap API changes: 718fdd2
  • src: dispose isolate before unregistering it : 84d01ac

@danmcd
Copy link

danmcd commented Apr 9, 2025

illumos (on SmartOS) update:

I can build this branch on the hacked-userlimit illumos system. I've yet to try it on the stock-userlimit (0xffff... limit) system. My test failures on the hacked-userlimit seem to match yours.

@richardlau
Copy link
Member

richardlau commented Apr 9, 2025

@richardlau are you able to do that?

Yes, I'll look at it after the TSC meeting.

Updated in nodejs/build#4066.

https://ci.nodejs.org/job/node-test-commit-v8-linux/6493/ ✅ is with the updated gn on 84d01ac (same commit as previously failing job).

@nodejs-github-bot
Copy link
Collaborator

targos and others added 24 commits April 25, 2025 13:34
The API was removed from V8.
New V8 version includes more information about regular expressions.
We depend on V8's version of simdutf now.
The location of some third-party code has changed.
`Isolate::AdjustAmountOfExternalAllocatedMemory` is deprecated.

Refs: v8/v8@7dc4c18
The `--expose_externalize_string` flag adds a new global.
As V8 is moving towards built-in CppHeap creation, change the
management so that the automatic CppHeap creation on Node.js's end
is also enforced at Isolate creation time.

1. If embedder uses NewIsolate(), either they use
  IsolateSettings::cpp_heap to specify a CppHeap that will be owned
  by V8, or if it's not configured, Node.js will create a CppHeap
  that will be owned by V8.
2. If the embedder uses SetIsolateUpForNode(),
  IsolateSettings::cpp_heap will be ignored (as V8 has deprecated
  attaching CppHeap post-isolate-creation). The embedders need to
  ensure that the v8::Isolate has a CppHeap attached while it's
  still used by Node.js, preferably using v8::CreateParams.

See https://issues.chromium.org/issues/42203693 for details. In
future version of V8, this CppHeap will be created by V8 if not
provided, and we can remove our own "if no CppHeap provided,
create one" code in NewIsolate().
Original commit message:

    [api] add Isolate::Deinitialize() and Isolate::Free()

    This allows embedders to mirror the isolate disposal routine
    with an initialization routine that uses Isolate::Allocate().

    ```
    v8::Isolate* isolate = v8::Isolate::Allocate();
    // Use the isolate address as a key.
    v8::Isolate::Initialize(isolate, params);

    isolate->Deinitialize();
    // Remove the entry keyed by isolate address.
    v8::Isolate::Free(isolate);
    ```

    Previously, the only way to dispose the isolate bundles the
    de-initialization and the freeing of the address together in
    v8::Isolate::Dispose(). This is inadequate for embedders like
    Node.js that uses the isolate address as a key to manage the
    task runner associated with it, if another thread gets an
    isolate allocated at the aligned address before the other
    thread finishes cleanup for the isolate previously allocated
    at the same address, and locking on the entire disposal can
    be too risky since it may post GC tasks that in turn requires
    using the isolate address to locate the task runner. It's a
    lot simpler to handle the issue if the disposal process of
    the isolate can mirror the initialization of it and split
    into two routines.

    Refs: nodejs#57753 (comment)
    Refs: nodejs#30850
    Bug: 412943769
    Change-Id: I3865c27395aded3a6f32de74d96d0698b2d891b9
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6480071
    Reviewed-by: Leszek Swirski <leszeks@chromium.org>
    Commit-Queue: Joyee Cheung <joyee@igalia.com>
    Cr-Commit-Position: refs/heads/main@{#99890}

Refs: v8/v8@954187b
The order of these calls is important. When the Isolate is disposed,
it may still post tasks to the platform, so it must still be registered
for the task runner to be found from the map. After the isolate is torn
down, we need to remove it from the map before we can free the address,
so that when another Isolate::Allocate() is called, that would not be
allocated to the same address and be registered on an existing map
entry.
@joyeecheung
Copy link
Member

rebased to address the conflict with simdutf update (in this branch it's still skipping deps/simdutf and using the one in deps/v8/third_party/simdutf - as discussed in nodejs/TSC#1728 let's just get it build first and think about how to move forward after 24, since simdutf headers aren't exposed anyway. A more probable solution going forward might be similar to v8#216 - we prefix our own copy of simdutf, similar to how we have two copies of zlib, to keep the one directly used by Node.js updatable throughout LTS.

Also changed the ABI version to 137 since electron is taking 136 #57979

@joyeecheung
Copy link
Member

@danmcd It seems the illumos should be upstreamable. Do you want to upload it to V8? In general it's preferred to get the patch reviewed and landed in the upstream before we float it to Node.js's fork, instead of having to maintain it in the fork again during the next V8 upgrades.

@nodejs-github-bot
Copy link
Collaborator

@danmcd
Copy link

danmcd commented Apr 25, 2025

@danmcd It seems the illumos should be upstreamable. Do you want to upload it to V8? In general it's preferred to get the patch reviewed and landed in the upstream before we float it to Node.js's fork, instead of having to maintain it in the fork again during the next V8 upgrades.

I would like to get it into V8, BUT V8 also has the related IBM AIX change under review which slightly complicates things. I do have a version of what you accepted as a post-IBM-AIX followup so V8 folks can take THAT after the IBM one (it's been locally tested with node too). I'll gladly accept any assistance from those with better knowledge of the V8 process.

@joyeecheung
Copy link
Member

Observations about the Windows crashes:

  1. They are both crashing at EphemeronRememberedSet::RecordEphemeronKeyWrite(), it appears the table map contains invalid tagged pointer keys during the insertion, likely being mutated by another thread (insertion is guarded by a mutex that's not locked by other threads doing erasure)
  2. The crash in test-stream-pipeline goes away when I enable --minor-ms, but it doesn't work for test-sqlite-statement-sync

It looks like either an upstream bug, or we happen to run in a configuration not supported by V8's GC now. I'll open an upstream issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. dependencies Pull requests that update a dependency file. help wanted Issues that need assistance from volunteers or PRs that need help to proceed. meta Issues and PRs related to the general management of the project. needs-ci PRs that need a full CI run. semver-major PRs that contain breaking changes and should be released in the next major version. v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants