Skip to content

Support snapshotting node:test #47832

Description

@RaisinTen

Version

v20.0.0

Platform

No response

Subsystem

bootstrap

What steps will reproduce the bug?

$ cat input.js
require('node:test')

$ lldb -- $(command -v node) --snapshot-blob snapshot.blob --build-snapshot input.js
(lldb) target create "/usr/local/bin/node"
Current executable set to '/usr/local/bin/node' (x86_64).
(lldb) settings set -- target.run-args  "--snapshot-blob" "snapshot.blob" "--build-snapshot" "input.js"
(lldb) run
Process 5484 launched: '/usr/local/bin/node' (x86_64)
(node:5484) Warning: built-in module test is not yet supported in user snapshots
(Use `node --trace-warnings ...` to show where the warning was created)
Unknown external reference 0x1001cc6e0.
<unresolved>
Process 5484 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)
    frame #0: 0x00000001014073e3 node`v8::base::OS::Abort() + 19
node`v8::base::OS::Abort:
->  0x1014073e3 <+19>: ud2
    0x1014073e5 <+21>: nopw   %cs:(%rax,%rax)
    0x1014073ef <+31>: nop

node`v8::base::OS::DebugBreak:
    0x1014073f0 <+0>:  pushq  %rbp
Target 0: (node) stopped.
(lldb) image lookup --address 0x1001cc6e0
      Address: node[0x00000001001cc6e0] (node.__TEXT.__text + 1869536)
      Summary: node`node::UDPWrapBase::RecvStart(v8::FunctionCallbackInfo<v8::Value> const&)
(lldb) ^D

So it complains that UDPWrapBase::RecvStart() -

node/src/udp_wrap.cc

Lines 645 to 648 in b0ca770

void UDPWrapBase::RecvStart(const FunctionCallbackInfo<Value>& args) {
UDPWrapBase* wrap = UDPWrapBase::FromObject(args.Holder());
args.GetReturnValue().Set(wrap == nullptr ? UV_EBADF : wrap->RecvStart());
}
has not been registered.

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior? Why is that the expected behavior?

Should warn and exit with a 0 error code instead of crashing.

What do you see instead?

It crashes.

Additional information

After #47779 lands, the error would reproduce while building a snapshot that requires the node:test module instead of test.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues requesting new Node.js features.staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.test_runnerIssues and PRs related to the test runner subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions