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

Heap snapshot crash on v14.x #42558

Closed
legendecas opened this issue Apr 1, 2022 · 4 comments
Closed

Heap snapshot crash on v14.x #42558

legendecas opened this issue Apr 1, 2022 · 4 comments
Labels
confirmed-bug Issues with confirmed bugs. v8 engine Issues and PRs related to the V8 dependency.

Comments

@legendecas
Copy link
Member

legendecas commented Apr 1, 2022

Version

v14.19.1

Platform

all

Subsystem

v8 engine

What steps will reproduce the bug?

Run the following script:

function that() {
  const p = new Promise(resolve => {
    setTimeout(resolve, 1);
  });
  Promise.all([p]); // <= The key problem here, it created a PromiseAllResolveElementContext which crashes the HeapSnapshotGenerator
}
that();

const v8 = require('v8');
const fs = require('fs');
const stream = fs.createWriteStream('./node.heapsnapshot');
v8.getHeapSnapshot().pipe(stream);

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

Always

What is the expected behavior?

No crashes.

What do you see instead?

The program crashed with SIGSEGV.

image

Additional information

Node.js v16.x doesn't have this problem. So I'd think we may need to find the v8 commit that fixed the problem and backport it to v14.x.

@legendecas legendecas added v8 engine Issues and PRs related to the V8 dependency. v14.x confirmed-bug Issues with confirmed bugs. labels Apr 1, 2022
@legendecas
Copy link
Member Author

legendecas commented Apr 1, 2022

It seems we already have a series of heap snapshot crashes on v14.x. And their crash backtrace is similar to the one in the OP:

@legendecas
Copy link
Member Author

I can confirm the problem can be fixed by a small v8 patch: https://chromium-review.googlesource.com/c/v8/v8/+/2277806

@legendecas
Copy link
Member Author

V8 bug tracking the problem: https://bugs.chromium.org/p/v8/issues/detail?id=10629

@legendecas
Copy link
Member Author

Closing as #42637 has landed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

No branches or pull requests

1 participant