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

Error: async hook stack has become corrupted (actual: 73, expected: 0) #38814

Closed
hongbo-miao opened this issue May 26, 2021 · 5 comments
Closed
Labels
async_hooks Issues and PRs related to the async hooks subsystem.

Comments

@hongbo-miao
Copy link

hongbo-miao commented May 26, 2021

  • Version: 16.2.0
  • Platform: Darwin 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64
  • Subsystem:

What steps will reproduce the bug?

Clone the repo: https://github.com/Hongbo-Miao/bug-nodejs-16

nvm use 16.2.0
npm install
npm run dev

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

The server will first run successfully. However, if you hit any endpoint such as openning http://localhost:5000, the server will crash.

What is the expected behavior?

Expecting the app not crash.

What do you see instead?

Crash with error:

Error: async hook stack has become corrupted (actual: 73, expected: 0)
 1: 0x10a031d5b node::AsyncHooks::pop_async_context(double) [/Users/homiao/.nvm/versions/node/v16.2.0/bin/node]
 2: 0x10a031b0c node::InternalCallbackScope::Close() [/Users/homiao/.nvm/versions/node/v16.2.0/bin/node]
 3: 0x10a0315de node::InternalCallbackScope::~InternalCallbackScope() [/Users/homiao/.nvm/versions/node/v16.2.0/bin/node]
 4: 0x10a0a2b88 node::Environment::RunTimers(uv_timer_s*) [/Users/homiao/.nvm/versions/node/v16.2.0/bin/node]
 5: 0x10aaf6877 uv__run_timers [/Users/homiao/.nvm/versions/node/v16.2.0/bin/node]
 6: 0x10aafb0ad uv_run [/Users/homiao/.nvm/versions/node/v16.2.0/bin/node]
 7: 0x10a032ea4 node::SpinEventLoop(node::Environment*) [/Users/homiao/.nvm/versions/node/v16.2.0/bin/node]
 8: 0x10a143414 node::NodeMainInstance::Run(node::EnvSerializeInfo const*) [/Users/homiao/.nvm/versions/node/v16.2.0/bin/node]
 9: 0x10a0cf97d node::Start(int, char**) [/Users/homiao/.nvm/versions/node/v16.2.0/bin/node]
10: 0x7fff2057a621 start [/usr/lib/system/libdyld.dylib]
11: 0x5

Some other times, I got

/Users/hm/.nvm/versions/node/v16.2.0/bin/node[89516]: ../src/api/callback.cc:125:void node::InternalCallbackScope::Close(): Assertion `(env_->execution_async_id()) == (0)' failed.
 1: 0x10ebbf7e5 node::Abort() (.cold.1) [/Users/hm/.nvm/versions/node/v16.2.0/bin/node]
 2: 0x10d872b39 node::Abort() [/Users/hm/.nvm/versions/node/v16.2.0/bin/node]
 3: 0x10d8729a1 node::Assert(node::AssertionInfo const&) [/Users/hm/.nvm/versions/node/v16.2.0/bin/node]
 4: 0x10d7a2cdd node::InternalCallbackScope::Close() [/Users/hm/.nvm/versions/node/v16.2.0/bin/node]
 5: 0x10d7a25de node::InternalCallbackScope::~InternalCallbackScope() [/Users/hm/.nvm/versions/node/v16.2.0/bin/node]
 6: 0x10d813b88 node::Environment::RunTimers(uv_timer_s*) [/Users/hm/.nvm/versions/node/v16.2.0/bin/node]
 7: 0x10e267877 uv__run_timers [/Users/hm/.nvm/versions/node/v16.2.0/bin/node]
 8: 0x10e26c0ad uv_run [/Users/hm/.nvm/versions/node/v16.2.0/bin/node]
 9: 0x10d7a3ea4 node::SpinEventLoop(node::Environment*) [/Users/hm/.nvm/versions/node/v16.2.0/bin/node]
10: 0x10d8b4414 node::NodeMainInstance::Run(node::EnvSerializeInfo const*) [/Users/hm/.nvm/versions/node/v16.2.0/bin/node]
11: 0x10d84097d node::Start(int, char**) [/Users/hm/.nvm/versions/node/v16.2.0/bin/node]
12: 0x7fff2057a621 start [/usr/lib/system/libdyld.dylib]
13: 0x7

Additional information

It only happens in Node.js since 16.2.0.
@kamilogorek provided some useful info at
getsentry/sentry-javascript#3585 (comment)

@hongbo-miao hongbo-miao changed the title [Node.js 16] void node::InternalCallbackScope::Close(): Assertion `(env_->execution_async_id()) == (0)' failed Error: async hook stack has become corrupted (actual: 73, expected: 0) May 27, 2021
@hongbo-miao hongbo-miao reopened this May 27, 2021
@Ayase-252
Copy link
Member

Would you provide a minimal repro without third-party module? It could be great helpful.

@hongbo-miao
Copy link
Author

hongbo-miao commented May 27, 2021

Hmm, this is already a quite minimal repo. It needs Sentry and OpenTelemetry together to trigger the error.
(The original repo is way larger)

@Ayase-252 Ayase-252 added the async_hooks Issues and PRs related to the async hooks subsystem. label May 27, 2021
@kamilogorek
Copy link

After doing some digging, the exact place where it triggers an exception in opentelemetry code - https://github.com/open-telemetry/opentelemetry-js/blob/7fa4ff70d1aad5875cb14c6bff99c838228447bb/packages/opentelemetry-tracing/src/MultiSpanProcessor.ts#L58

@Ayase-252
Copy link
Member

Reproduciable in master

Qard pushed a commit to Qard/node that referenced this issue Jun 3, 2021
🤦 Might help if I remember to disable the _other_ promise
hook implementation when switching between them...

Fixes nodejs#38814
Fixes nodejs#38815
Qard pushed a commit to Qard/node that referenced this issue Jun 3, 2021
🤦 Might help if I remember to disable the _other_ promise
hook implementation when switching between them...

Fixes nodejs#38814
Fixes nodejs#38815
Qard pushed a commit to Qard/node that referenced this issue Jun 3, 2021
🤦 Might help if I remember to disable the _other_ promise
hook implementation when switching between them...

Fixes nodejs#38814
Fixes nodejs#38815
Qard pushed a commit to Qard/node that referenced this issue Jun 3, 2021
🤦 Might help if I remember to disable the _other_ promise
hook implementation when switching between them...

Fixes nodejs#38814
Fixes nodejs#38815
Qard pushed a commit to Qard/node that referenced this issue Jun 3, 2021
🤦 Might help if I remember to disable the _other_ promise
hook implementation when switching between them...

Fixes nodejs#38814
Fixes nodejs#38815
Qard pushed a commit to Qard/node that referenced this issue Jun 3, 2021
🤦 Might help if I remember to disable the _other_ promise
hook implementation when switching between them...

Fixes nodejs#38814
Fixes nodejs#38815
@Flarna Flarna closed this as completed in 1c36eef Jun 5, 2021
@Qard
Copy link
Member

Qard commented Jun 6, 2021

This should be fixed by #38912 which will be in the next release, likely 16.3.1 or 16.4.0. If you have any further issues, let me know!

targos pushed a commit that referenced this issue Jun 11, 2021
🤦 Might help if I remember to disable the _other_ promise
hook implementation when switching between them...

Fixes #38814
Fixes #38815
Refs #36394

PR-URL: #38912
Reviewed-By: Vladimir de Turckheim <[email protected]>
Reviewed-By: Gerhard Stöbich <[email protected]>
Reviewed-By: Bryan English <[email protected]>
Qard pushed a commit to Qard/node that referenced this issue Jun 15, 2021
🤦 Might help if I remember to disable the _other_ promise
hook implementation when switching between them...

Fixes nodejs#38814
Fixes nodejs#38815
Refs nodejs#36394

PR-URL: nodejs#38912
Reviewed-By: Vladimir de Turckheim <[email protected]>
Reviewed-By: Gerhard Stöbich <[email protected]>
Reviewed-By: Bryan English <[email protected]>
Qard pushed a commit to Qard/node that referenced this issue Jul 19, 2021
🤦 Might help if I remember to disable the _other_ promise
hook implementation when switching between them...

Fixes nodejs#38814
Fixes nodejs#38815
Refs nodejs#36394

PR-URL: nodejs#38912
Reviewed-By: Vladimir de Turckheim <[email protected]>
Reviewed-By: Gerhard Stöbich <[email protected]>
Reviewed-By: Bryan English <[email protected]>
Qard pushed a commit to Qard/node that referenced this issue Jul 21, 2021
🤦 Might help if I remember to disable the _other_ promise
hook implementation when switching between them...

Fixes nodejs#38814
Fixes nodejs#38815
Refs nodejs#36394

PR-URL: nodejs#38912
Reviewed-By: Vladimir de Turckheim <[email protected]>
Reviewed-By: Gerhard Stöbich <[email protected]>
Reviewed-By: Bryan English <[email protected]>
Qard pushed a commit to Qard/node that referenced this issue Jul 21, 2021
🤦 Might help if I remember to disable the _other_ promise
hook implementation when switching between them...

Fixes nodejs#38814
Fixes nodejs#38815
Refs nodejs#36394

PR-URL: nodejs#38912
Reviewed-By: Vladimir de Turckheim <[email protected]>
Reviewed-By: Gerhard Stöbich <[email protected]>
Reviewed-By: Bryan English <[email protected]>
Qard pushed a commit to Qard/node that referenced this issue Jul 21, 2021
🤦 Might help if I remember to disable the _other_ promise
hook implementation when switching between them...

Fixes nodejs#38814
Fixes nodejs#38815
Refs nodejs#36394

PR-URL: nodejs#38912
Reviewed-By: Vladimir de Turckheim <[email protected]>
Reviewed-By: Gerhard Stöbich <[email protected]>
Reviewed-By: Bryan English <[email protected]>
Qard pushed a commit to Qard/node that referenced this issue Aug 1, 2021
🤦 Might help if I remember to disable the _other_ promise
hook implementation when switching between them...

Fixes nodejs#38814
Fixes nodejs#38815
Refs nodejs#36394

PR-URL: nodejs#38912
Reviewed-By: Vladimir de Turckheim <[email protected]>
Reviewed-By: Gerhard Stöbich <[email protected]>
Reviewed-By: Bryan English <[email protected]>
targos pushed a commit that referenced this issue Aug 3, 2021
🤦 Might help if I remember to disable the _other_ promise
hook implementation when switching between them...

Fixes #38814
Fixes #38815
Refs #36394

PR-URL: #38912
Backport-PR-URL: #38577
Reviewed-By: Vladimir de Turckheim <[email protected]>
Reviewed-By: Gerhard Stöbich <[email protected]>
Reviewed-By: Bryan English <[email protected]>
BethGriggs pushed a commit that referenced this issue Aug 12, 2021
🤦 Might help if I remember to disable the _other_ promise
hook implementation when switching between them...

Fixes #38814
Fixes #38815
Refs #36394

PR-URL: #38912
Backport-PR-URL: #38577
Reviewed-By: Vladimir de Turckheim <[email protected]>
Reviewed-By: Gerhard Stöbich <[email protected]>
Reviewed-By: Bryan English <[email protected]>
MylesBorins pushed a commit that referenced this issue Aug 31, 2021
🤦 Might help if I remember to disable the _other_ promise
hook implementation when switching between them...

Fixes #38814
Fixes #38815
Refs #36394

PR-URL: #38912
Backport-PR-URL: #38577
Reviewed-By: Vladimir de Turckheim <[email protected]>
Reviewed-By: Gerhard Stöbich <[email protected]>
Reviewed-By: Bryan English <[email protected]>
foxxyz pushed a commit to foxxyz/node that referenced this issue Oct 18, 2021
🤦 Might help if I remember to disable the _other_ promise
hook implementation when switching between them...

Fixes nodejs#38814
Fixes nodejs#38815
Refs nodejs#36394

PR-URL: nodejs#38912
Backport-PR-URL: nodejs#38577
Reviewed-By: Vladimir de Turckheim <[email protected]>
Reviewed-By: Gerhard Stöbich <[email protected]>
Reviewed-By: Bryan English <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
async_hooks Issues and PRs related to the async hooks subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants