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 22.5.0 started to crash and hangs on different cases #53902

Closed
zloirock opened this issue Jul 17, 2024 · 47 comments · Fixed by #53904 or 51Degrees/pipeline-node#129
Closed

Node 22.5.0 started to crash and hangs on different cases #53902

zloirock opened this issue Jul 17, 2024 · 47 comments · Fixed by #53904 or 51Degrees/pipeline-node#129
Labels
confirmed-bug Issues with confirmed bugs. fs Issues and PRs related to the fs subsystem / file system. regression Issues related to regressions. v8 engine Issues and PRs related to the V8 dependency. v22.x v22.x Issues that can be reproduced on v22.x or PRs targeting the v22.x-staging branch.

Comments

@zloirock
Copy link

zloirock commented Jul 17, 2024

Version

22.5.0

Platform

macOS 15.0, M1

What steps will reproduce the bug?

Now I haven't much time to properly debug it, so a couple of cases:

Clone core-js repo.

npm i just hangs on.

Ok, if we somehow install dependencies and run npm test, Node crashes with:

FATAL ERROR: v8::Object::GetCreationContextChecked No creation context available
----- Native stack trace -----

 1: 0x104a4e230 node::OnFatalError(char const*, char const*) [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
 2: 0x104c20898 v8::Utils::ReportApiFailure(char const*, char const*) [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
 3: 0x104c358fc v8::Object::GetCreationContextChecked() [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
 4: 0x104a55f88 node::fs::FastClose(v8::Local<v8::Object>, int, v8::FastApiCallbackOptions&) [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
 5: 0x10b9accc4 
 6: 0x1056a6c0c Builtins_JSEntryTrampoline [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
 7: 0x1056a68f4 Builtins_JSEntry [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
 8: 0x104d50564 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
 9: 0x104d4fadc v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*) [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
10: 0x104c369cc v8::Function::Call(v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*) [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
11: 0x104970fa0 node::InternalMakeCallback(node::Environment*, v8::Local<v8::Object>, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*, node::async_context) [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
12: 0x104987d8c node::AsyncWrap::MakeCallback(v8::Local<v8::Function>, int, v8::Local<v8::Value>*) [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
13: 0x104a53ca4 node::fs::FSReqCallback::Resolve(v8::Local<v8::Value>) [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
14: 0x104a549a8 node::fs::AfterInteger(uv_fs_s*) [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
15: 0x104a482fc node::MakeLibuvRequestCallback<uv_fs_s, void (*)(uv_fs_s*)>::Wrapper(uv_fs_s*) [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
16: 0x105684a70 uv__work_done [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
17: 0x105688544 uv__async_io [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
18: 0x10569ab08 uv__io_poll [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
19: 0x105688b08 uv_run [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
20: 0x104971714 node::SpinEventLoopInternal(node::Environment*) [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
21: 0x104a8f8f0 node::NodeMainInstance::Run(node::ExitCode*, node::Environment*) [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
22: 0x104a8f688 node::NodeMainInstance::Run() [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
23: 0x104a15928 node::Start(int, char**) [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
24: 0x18b2cf274 start [/usr/lib/dyld]


#
# Fatal error in , line 0
# Missing deoptimization information for OptimizedFrame::Summarize.
#
#
#
#FailureMessage Object: 0x16b488648
----- Native stack trace -----

 1: 0x104ab7a4c node::NodePlatform::GetStackTracePrinter()::$_3::__invoke() [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
 2: 0x105f3e5d4 V8_Fatal(char const*, ...) [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
 3: 0x104d5993c v8::internal::OptimizedFrame::Summarize(std::__1::vector<v8::internal::FrameSummary, std::__1::allocator<v8::internal::FrameSummary>>*) const [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
 4: 0x104d62c60 v8::internal::Isolate::CaptureDetailedStackTrace(int, v8::StackTrace::StackTraceOptions) [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
 5: 0x104c2ace0 v8::StackTrace::CurrentStackTrace(v8::Isolate*, int, v8::StackTrace::StackTraceOptions) [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
 6: 0x104a4cc0c node::GetCurrentStackTrace(v8::Isolate*, int) [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
 7: 0x1049b869c node::DumpJavaScriptBacktrace(__sFILE*) [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
 8: 0x104a4e238 node::OnFatalError(char const*, char const*) [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
 9: 0x104c20898 v8::Utils::ReportApiFailure(char const*, char const*) [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
10: 0x104c358fc v8::Object::GetCreationContextChecked() [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
11: 0x104a55f88 node::fs::FastClose(v8::Local<v8::Object>, int, v8::FastApiCallbackOptions&) [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
12: 0x10b9accc4 
13: 0x1056a6c0c Builtins_JSEntryTrampoline [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
14: 0x1056a68f4 Builtins_JSEntry [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
15: 0x104d50564 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
16: 0x104d4fadc v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*) [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
17: 0x104c369cc v8::Function::Call(v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*) [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
18: 0x104970fa0 node::InternalMakeCallback(node::Environment*, v8::Local<v8::Object>, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*, node::async_context) [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
19: 0x104987d8c node::AsyncWrap::MakeCallback(v8::Local<v8::Function>, int, v8::Local<v8::Value>*) [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
20: 0x104a53ca4 node::fs::FSReqCallback::Resolve(v8::Local<v8::Value>) [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
21: 0x104a549a8 node::fs::AfterInteger(uv_fs_s*) [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
22: 0x104a482fc node::MakeLibuvRequestCallback<uv_fs_s, void (*)(uv_fs_s*)>::Wrapper(uv_fs_s*) [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
23: 0x105684a70 uv__work_done [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
24: 0x105688544 uv__async_io [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
25: 0x10569ab08 uv__io_poll [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
26: 0x105688b08 uv_run [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
27: 0x104971714 node::SpinEventLoopInternal(node::Environment*) [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
28: 0x104a8f8f0 node::NodeMainInstance::Run(node::ExitCode*, node::Environment*) [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
29: 0x104a8f688 node::NodeMainInstance::Run() [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
30: 0x104a15928 node::Start(int, char**) [/Users/denispuskarev/.nvm/versions/node/v22.5.0/bin/node]
31: 0x18b2cf274 start [/usr/lib/dyld]
/bin/bash: line 1: 92352 Trace/BPT trap: 5       npm run build-compat

on this script.

The same error happens, for example, if we somehow built it (for example, with the previous Node version) and run other scripts like this.

In most of those cases used zx and / or konan.

Sure, before Node 22.5.0, everything worked fine.

@RedYetiDev RedYetiDev added fs Issues and PRs related to the fs subsystem / file system. v8 engine Issues and PRs related to the V8 dependency. labels Jul 17, 2024
@RedYetiDev
Copy link
Member

Given the stack trace you've produced, I've optimistically applied the fs and v8 engine labels, but those can always be changed.

@cjihrig
Copy link
Contributor

cjihrig commented Jul 17, 2024

#53627 seems like the likely culprit.

@RedYetiDev
Copy link
Member

RedYetiDev commented Jul 17, 2024

Also, for reference, the erroring line is

Environment* env = Environment::GetCurrent(recv->GetCreationContextChecked());

@merceyz
Copy link
Member

merceyz commented Jul 17, 2024

Similar issue showing up in Yarn (yarnpkg/berry#6398), it either hangs or if run with CI=true then node stops mid execution without an error code.
Bisects to #53627.

@RedYetiDev RedYetiDev added confirmed-bug Issues with confirmed bugs. regression Issues related to regressions. v22.x v22.x Issues that can be reproduced on v22.x or PRs targeting the v22.x-staging branch. labels Jul 17, 2024
@RedYetiDev
Copy link
Member

I've opened a revert PR #53904 if this needs to be reverted.

@anonrig
Copy link
Member

anonrig commented Jul 17, 2024

@joyeecheung Any idea how is this possible?

v8::Object::GetCreationContextChecked No creation context available

@anonrig
Copy link
Member

anonrig commented Jul 17, 2024

This needs a better repro than the following command which runs 10+ subprocesses.

npm run r (that's cleaning + installing dependencies + npm test) just hangs on.

@RedYetiDev
Copy link
Member

RedYetiDev commented Jul 17, 2024

https://github.com/latin-1/berry-node-22.5.0-broken/ is slightly better, but not perfect.

STREAM 55954: do read
STREAM 55954: push null
STREAM 55954: onEofChunk
STREAM 55954: emitReadable_
STREAM 55954: flow
STREAM 55954: read undefined
STREAM 55954: endReadable
STREAM 55954: endReadableNT
Usage Error: Couldn't find the node_modules state file - running an install might help (findPackageLocation)

@anonrig
Copy link
Member

anonrig commented Jul 17, 2024

I can not test it locally, but technically this should fix the bug: #53910

@targos
Copy link
Member

targos commented Jul 17, 2024

I think we should hold on landing future fast API pull requests until we have a way to guarantee that the added code paths are tested.

@anonrig
Copy link
Member

anonrig commented Jul 17, 2024

OK I found a reproduction, and the fix I proposed works.

Here's the repro:

const fs = require('fs')

let failed;
for (let i = 0; i < 1_000_000; i++) {
  failed = fs.readFile('./configure.py', (err, done) => {
    // do nothing
    console.log(err, done)
  })
}
console.log(failed)

I think we should hold on landing future fast API pull requests until we have a way to guarantee that the added code paths are tested.

Agreed.

@merceyz
Copy link
Member

merceyz commented Jul 17, 2024

https://github.com/latin-1/berry-node-22.5.0-broken/ is slightly better, but not perfect.

@RedYetiDev Note that the issue happens in the yarn step where the process exits early without an error, yarn build fails because yarn failed.

@merceyz
Copy link
Member

merceyz commented Jul 17, 2024

I can not test it locally, but technically this should fix the bug: #53910

#53910 doesn't fix #53902 (comment) but reverting #53627 does.

@ajayk

This comment has been minimized.

@RedYetiDev
Copy link
Member

I can not test it locally, but technically this should fix the bug: #53910

#53910 doesn't fix #53902 (comment) but reverting #53627 does.

#53904?

@anonrig
Copy link
Member

anonrig commented Jul 17, 2024

#53910 doesn't fix #53902 (comment) but reverting #53627 does.

#53910 fixes the issue. What makes you think that it doesn't fix the issue?

@latin-1
Copy link

latin-1 commented Jul 17, 2024

@anonrig They might be two different issues with FastClose, I guess? The yarn one does not crash; it hangs/exits without leaving any stack traces.

@anonrig
Copy link
Member

anonrig commented Jul 17, 2024

@anonrig They might be two different issues with FastClose, I guess? The yarn one does not crash; it hangs/exits without leaving any stack traces.

If that's the issue, can you open a different/new issue with a reproducible test case?

@merceyz
Copy link
Member

merceyz commented Jul 17, 2024

#53910 doesn't fix #53902 (comment) but reverting #53627 does.

#53910 fixes the issue. What makes you think that it doesn't fix the issue?

Not the one I linked to in that comment.

I can not test it locally, but technically this should fix the bug: #53910

#53910 doesn't fix #53902 (comment) but reverting #53627 does.

#53904?

Yeah, with that PR (or when I git revert #53627 on v22.5.0) the yarn command completes successfully.

@nicomsz
Copy link

nicomsz commented Jul 19, 2024

The https://github.com/nodejs/node/releases/tag/v22.5.1 was just published. Please upgrade back to v22.5.1 or 22.x or latest, if you're pinned your version to v22.4.1

how can i upgrade to v22.5.1 on docker? it is returning me that error: ERROR: failed to solve: node:22.5.1: failed to resolve source metadata for docker.io/library/node:22.5.1: no match for platform in manifest: not found

@melroy89
Copy link

The https://github.com/nodejs/node/releases/tag/v22.5.1 was just published. Please upgrade back to v22.5.1 or 22.x or latest, if you're pinned your version to v22.4.1

how can i upgrade to v22.5.1 on docker? it is returning me that error: ERROR: failed to solve: node:22.5.1: failed to resolve source metadata for docker.io/library/node:22.5.1: no match for platform in manifest: not found

Yup same..

@trivikr
Copy link
Member

trivikr commented Jul 19, 2024

Node.js v22.5.1 is available on Docker since Jul 19, 2024 at 2:42 PM Pacific

https://hub.docker.com/layers/library/node/22.5.1/images/sha256-a18c05b559a62b7530390cbf9720e737fe04178530b8f5c49dbaac8f1c5f3a89?context=explore


It takes some time, as it's done using a PR by automation bot post-release which needs to be manually reviewed and merged.
Example automated PR for v22.5.1 nodejs/docker-node#2122

pi-alexander-popel added a commit to postindustria-tech/location-node that referenced this issue Jul 22, 2024
pi-alexander-popel added a commit to postindustria-tech/pipeline-node that referenced this issue Jul 22, 2024
pi-alexander-popel added a commit to postindustria-tech/device-detection-node that referenced this issue Jul 22, 2024
lucaong added a commit to lucaong/minisearch that referenced this issue Jul 22, 2024
The CI builds started failing on node `v22.5.0` likely due to
nodejs/node#53902

The NodeJS version on CI was therefore pinned to 21 in
#272

This pull request goes back to using the latest NodeJS version, and
should be merged to master once the issue with NodeJS `v22.5.0` noted
above is fixed, and the build on this pull request succeeds.
mhassan1 added a commit to mrhenry/polyfill-library that referenced this issue Jul 22, 2024
anna-parker added a commit to loculus-project/loculus that referenced this issue Jul 23, 2024
anna-parker added a commit to loculus-project/loculus that referenced this issue Jul 23, 2024
…a patch.…" (#2325)

This reverts commit d2832db as node v22.5 is now patched
github-merge-queue bot pushed a commit to pulumi/pulumi that referenced this issue Jul 23, 2024
Reverts #16709

The underlying issue has been fixed in node 20.5.1
nodejs/node#53902

Fixes #16707
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. fs Issues and PRs related to the fs subsystem / file system. regression Issues related to regressions. v8 engine Issues and PRs related to the V8 dependency. v22.x v22.x Issues that can be reproduced on v22.x or PRs targeting the v22.x-staging branch.
Projects
None yet