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

Fatal error when snapshotting #46902

Closed
nitsky opened this issue Mar 1, 2023 · 4 comments
Closed

Fatal error when snapshotting #46902

nitsky opened this issue Mar 1, 2023 · 4 comments
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs. snapshot Issues and PRs related to the startup snapshot worker Issues and PRs related to Worker support.

Comments

@nitsky
Copy link

nitsky commented Mar 1, 2023

Version

19.7.0

Platform

Darwin 22.2.0 Darwin Kernel Version 22.2.0: Fri Nov 11 02:03:51 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T6000 arm64

Subsystem

No response

What steps will reproduce the bug?

Hi, I observe that snapshotting fails when I include ESLint (https://eslint.org) in the snapshot.

  1. Clone the ESLint source from github.com/eslint/eslint.
  2. Run npm i && npm run build:webpack.
  3. Run node --build-snapshot ./build/eslint.js. Note that node ./build/eslint.js succeeds.

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

Always.

What is the expected behavior?

I expect snapshotting to succeed.

What do you see instead?

#
# Fatal error in , line 0
# Check failed: handle_checker.CheckGlobalAndEternalHandles().
#
#
#
#FailureMessage Object: 0x16f29eba8
 1: 0x100e018c8 node::NodePlatform::GetStackTracePrinter()::$_3::__invoke() [/opt/homebrew/Cellar/node/19.7.0/bin/node]
 2: 0x10167e28c V8_Fatal(char const*, ...) [/opt/homebrew/Cellar/node/19.7.0/bin/node]
 3: 0x100ef9c24 v8::SnapshotCreator::CreateBlob(v8::SnapshotCreator::FunctionCodeHandling) [/opt/homebrew/Cellar/node/19.7.0/bin/node]
 4: 0x100e25ce4 node::SnapshotBuilder::CreateSnapshot(node::SnapshotData*, node::CommonEnvironmentSetup*, unsigned char) [/opt/homebrew/Cellar/node/19.7.0/bin/node]

Additional information

No response

@marco-ippolito marco-ippolito added the snapshot Issues and PRs related to the startup snapshot label Mar 1, 2023
@parmishh
Copy link

parmishh commented Mar 2, 2023

the error message you are seeing indicates a failure in the V8 engine during snapshot creation.
The following steps may work:
Try updating the version of Node.js or the V8 engine to the latest version
Check the code being snapshot for any potential memory leaks or issues with global or eternal handles.
Ensure that all handles are properly accounted for and cleaned up when they are no longer needed.

@bnoordhuis
Copy link
Member

Was there a "handle not serialized" error message further up? You didn't include it but I'd expect to see it.

Also, can you try with the official node binary instead of homebrew's?

@nitsky
Copy link
Author

nitsky commented Mar 4, 2023

@bnoordhuis I installed the official binary and ran it again. The error message begins with "global handle not serialized". See the full error message here: error.txt.

@bnoordhuis
Copy link
Member

Thanks. I'll include it inline for posterity:

global handle not serialized: 0x17d4b437c6d9: [[api object] 0] in OldSpace
 - map: 0x155139ae2bb9 <Map[40](HOLEY_ELEMENTS)> [FastProperties]
 - prototype: 0x2646f5c57779 <Object map = 0x10e1d3041d51>
 - elements: 0x0443ae381321 <FixedArray[0]> [HOLEY_ELEMENTS]
 - embedder fields: 2
 - properties: 0x17d4b437ce99 <PropertyArray[9]>
 - All own properties (excluding elements): {
    0x0e0365179f79 <Symbol: kEvents>: 0x17d4b437c701 <Map map = 0x22fe1b250d71> (const data field 0), location: properties[0]
    0x257d159e47e9 <Symbol: events.maxEventTargetListeners>: 10 (const data field 1), location: properties[1]
    0x257d159e4801 <Symbol: events.maxEventTargetListenersWarned>: 0x0443ae381781 <false> (const data field 2), location: properties[2]
    0x0e0365179fd9 <Symbol: kHandlers>: 0x17d4b437c829 <Map map = 0x22fe1b250d71> (const data field 3), location: properties[3]
    0x0e036517a021 <Symbol: kNewListener>: 0x155139ae2aa9 <JSFunction eventEmitter.<computed> (sfi = 0x155139ae04e1)> (const data field 4), location: properties[4]
    0x0e036517a039 <Symbol: kRemoveListener>: 0x155139ae2b31 <JSFunction eventEmitter.<computed> (sfi = 0x155139ae0571)> (const data field 5), location: properties[5]
    0x03ddafb7ab69 <Symbol: nodejs.internal.kCurrentlyReceivingPorts>: 0x0443ae3815b1 <undefined> (const data field 6), location: properties[6]
 }
 - embedder fields = {
    1, aligned pointer: 0x103e60048
    24576, aligned pointer: 0x60000186c1e0
 }

global handle not serialized: 0x22fe1b252121: [Function] in OldSpace
 - map: 0x03ddafb46d91 <Map[64](HOLEY_ELEMENTS)> [FastProperties]
 - prototype: 0x03ddafb45b71 <JSFunction (sfi = 0x2d7690d070c1)>
 - elements: 0x0443ae381321 <FixedArray[0]> [HOLEY_ELEMENTS]
 - function prototype:
 - initial_map:
 - shared_info: 0x22fe1b251e69 <SharedFunctionInfo exports.emitMessage>
 - name: 0x0443ae3817c9 <String[0]: #>
 - builtin: CompileLazy
 - formal_parameter_count: 3
 - kind: NormalFunction
 - context: 0x17d4b434b691 <FunctionContext[5]>
 - code: 0x000105588801 <Code BUILTIN CompileLazy>
 - source code: (data, ports, type) {
  if (typeof this[kHybridDispatch] === 'function') {
    this[kCurrentlyReceivingPorts] = ports;
    try {
      this[kHybridDispatch](data, type, undefined);
    } finally {
      this[kCurrentlyReceivingPorts] = undefined;
    }
    return;
  }

  const event = new MessageEvent(data, this, type, ports);
  if (type === 'message') {
    if (typeof this.onmessage === 'function')
      this.onmessage(event);
  } else {
    // eslint-disable-next-line no-lonely-if
    if (typeof this.onmessageerror === 'function')
      this.onmessageerror(event);
  }
}
 - properties: 0x0443ae381321 <FixedArray[0]>
 - All own properties (excluding elements): {
    0x443ae3878c9: [String] in ReadOnlySpace: #length: 0x2d7690d03c59 <AccessorInfo name= 0x0443ae3878c9 <String[6]: #length>, data= 0x0443ae3815b1 <undefined>> (const accessor descriptor), location: descriptor
    0x443ae387bc1: [String] in ReadOnlySpace: #name: 0x2d7690d03c29 <AccessorInfo name= 0x0443ae387bc1 <String[4]: #name>, data= 0x0443ae3815b1 <undefined>> (const accessor descriptor), location: descriptor
    0x443ae387f51: [String] in ReadOnlySpace: #prototype: 0x2d7690d03c89 <AccessorInfo name= 0x0443ae387f51 <String[9]: #prototype>, data= 0x0443ae3815b1 <undefined>> (const accessor descriptor), location: descriptor
 }
 - feedback vector: feedback metadata is not available in SFI

global handle not serialized: 0x17d4b437cef1: [[api object] 0] in OldSpace
 - map: 0x155139ae2bb9 <Map[40](HOLEY_ELEMENTS)> [FastProperties]
 - prototype: 0x2646f5c57779 <Object map = 0x10e1d3041d51>
 - elements: 0x0443ae381321 <FixedArray[0]> [HOLEY_ELEMENTS]
 - embedder fields: 2
 - properties: 0x17d4b437d3b1 <PropertyArray[9]>
 - All own properties (excluding elements): {
    0x0e0365179f79 <Symbol: kEvents>: 0x17d4b437cf19 <Map map = 0x22fe1b250d71> (const data field 0), location: properties[0]
    0x257d159e47e9 <Symbol: events.maxEventTargetListeners>: 10 (const data field 1), location: properties[1]
    0x257d159e4801 <Symbol: events.maxEventTargetListenersWarned>: 0x0443ae381781 <false> (const data field 2), location: properties[2]
    0x0e0365179fd9 <Symbol: kHandlers>: 0x17d4b437cfd1 <Map map = 0x22fe1b250d71> (const data field 3), location: properties[3]
    0x0e036517a021 <Symbol: kNewListener>: 0x155139ae2c89 <JSFunction eventEmitter.<computed> (sfi = 0x155139ae04e1)> (const data field 4), location: properties[4]
    0x0e036517a039 <Symbol: kRemoveListener>: 0x155139ae2cc9 <JSFunction eventEmitter.<computed> (sfi = 0x155139ae0571)> (const data field 5), location: properties[5]
    0x03ddafb7ab69 <Symbol: nodejs.internal.kCurrentlyReceivingPorts>: 0x0443ae3815b1 <undefined> (const data field 6), location: properties[6]
 }
 - embedder fields = {
    1, aligned pointer: 0x103e60048
    24576, aligned pointer: 0x60000186c2d0
 }

global handle not serialized: 0x22fe1b252121: [Function] in OldSpace
 - map: 0x03ddafb46d91 <Map[64](HOLEY_ELEMENTS)> [FastProperties]
 - prototype: 0x03ddafb45b71 <JSFunction (sfi = 0x2d7690d070c1)>
 - elements: 0x0443ae381321 <FixedArray[0]> [HOLEY_ELEMENTS]
 - function prototype:
 - initial_map:
 - shared_info: 0x22fe1b251e69 <SharedFunctionInfo exports.emitMessage>
 - name: 0x0443ae3817c9 <String[0]: #>
 - builtin: CompileLazy
 - formal_parameter_count: 3
 - kind: NormalFunction
 - context: 0x17d4b434b691 <FunctionContext[5]>
 - code: 0x000105588801 <Code BUILTIN CompileLazy>
 - source code: (data, ports, type) {
  if (typeof this[kHybridDispatch] === 'function') {
    this[kCurrentlyReceivingPorts] = ports;
    try {
      this[kHybridDispatch](data, type, undefined);
    } finally {
      this[kCurrentlyReceivingPorts] = undefined;
    }
    return;
  }

  const event = new MessageEvent(data, this, type, ports);
  if (type === 'message') {
    if (typeof this.onmessage === 'function')
      this.onmessage(event);
  } else {
    // eslint-disable-next-line no-lonely-if
    if (typeof this.onmessageerror === 'function')
      this.onmessageerror(event);
  }
}
 - properties: 0x0443ae381321 <FixedArray[0]>
 - All own properties (excluding elements): {
    0x443ae3878c9: [String] in ReadOnlySpace: #length: 0x2d7690d03c59 <AccessorInfo name= 0x0443ae3878c9 <String[6]: #length>, data= 0x0443ae3815b1 <undefined>> (const accessor descriptor), location: descriptor
    0x443ae387bc1: [String] in ReadOnlySpace: #name: 0x2d7690d03c29 <AccessorInfo name= 0x0443ae387bc1 <String[4]: #name>, data= 0x0443ae3815b1 <undefined>> (const accessor descriptor), location: descriptor
    0x443ae387f51: [String] in ReadOnlySpace: #prototype: 0x2d7690d03c89 <AccessorInfo name= 0x0443ae387f51 <String[9]: #prototype>, data= 0x0443ae3815b1 <undefined>> (const accessor descriptor), location: descriptor
 }
 - feedback vector: feedback metadata is not available in SFI



#
# Fatal error in , line 0
# Check failed: handle_checker.CheckGlobalAndEternalHandles().
#
#
#
#FailureMessage Object: 0x16fdbaaf8
 1: 0x10015b534 node::NodePlatform::GetStackTracePrinter()::$_3::__invoke() [/usr/local/bin/node]
 2: 0x101137fc0 V8_Fatal(char const*, ...) [/usr/local/bin/node]
 3: 0x100257548 v8::SnapshotCreator::CreateBlob(v8::SnapshotCreator::FunctionCodeHandling) [/usr/local/bin/node]
 4: 0x10017d6a0 node::SnapshotBuilder::CreateSnapshot(node::SnapshotData*, node::CommonEnvironmentSetup*, unsigned char) [/usr/local/bin/node]
 5: 0x10017d0d4 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> > > >, 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> > > >) [/usr/local/bin/node]
 6: 0x1000c6e34 node::GenerateAndWriteSnapshotData(node::SnapshotData const**, node::InitializationResultImpl const*) [/usr/local/bin/node]
 7: 0x1000c7458 node::Start(int, char**) [/usr/local/bin/node]
 8: 0x197937e50 start [/usr/lib/dyld]
zsh: trace trap  /usr/local/bin/node --build-snapshot ./build/eslint.js

It looks like eslint starts worker threads and those can't be snapshotted yet, see tracking issue #44014.

I'll close this as a known issue/duplicate but you can follow the tracking issue for updates.

@bnoordhuis bnoordhuis closed this as not planned Won't fix, can't repro, duplicate, stale Mar 5, 2023
@bnoordhuis bnoordhuis added duplicate Issues and PRs that are duplicates of other issues or PRs. worker Issues and PRs related to Worker support. labels Mar 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs. snapshot Issues and PRs related to the startup snapshot worker Issues and PRs related to Worker support.
Projects
None yet
Development

No branches or pull requests

4 participants