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

async_hooks: fix resource stack for deep stacks #34573

Closed
wants to merge 1 commit into from

Conversation

addaleax
Copy link
Member

@addaleax addaleax commented Jul 31, 2020

460c81d introduced a bug where the execution resource was not
stored properly if we needed to call into C++ to extend the stack size.
Fix that bug by always storing the resource.

Refs: #34319
Fixes: #34556

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot nodejs-github-bot added the async_hooks Issues and PRs related to the async hooks subsystem. label Jul 31, 2020
if (count !== 0) return als.run({}, run, --count)
done();
}
run(1000);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fwiw, this still crashes for me for larger values (e.g. 2000), but with a different error and unrelated to the bug that this is fixing, and depending on --stack-size, i.e. there’s probably something wrong with our error handling here.

@puzpuzpuz
Copy link
Member

Does it make sense to mention that this PR fixes #34556?

460c81d introduced a bug where the execution resource was not
stored properly if we needed to call into C++ to extend the stack size.
Fix that bug by always storing the resource.

Refs: nodejs#34319
Fixes: nodejs#34556
@addaleax
Copy link
Member Author

@puzpuzpuz Yup, added a Fixes: tag here. As mentioned above, it doesn’t fix the problem for when the stack gets very large, so there’s still a bug around, but I think it’s fair to say that it’s distinct from #34556.

@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Aug 1, 2020

CI: https://ci.nodejs.org/job/node-test-pull-request/32591/ (:green_heart:)

@puzpuzpuz
Copy link
Member

@nodejs/async_hooks looks like this fix requires another reviewer.

@addaleax addaleax added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. review wanted PRs that need reviews. labels Aug 1, 2020
@Flarna
Copy link
Member

Flarna commented Aug 2, 2020

Of curiosity: Why do we have a managed and a native stack? Couldn't we use one stack shared between managed and native?

@addaleax
Copy link
Member Author

addaleax commented Aug 2, 2020

@Flarna See #34319 – it’s for performance reasons, because we don’t have a data structure that is both fast to access from C++ and fast to access from JS.

puzpuzpuz pushed a commit that referenced this pull request Aug 3, 2020
460c81d introduced a bug where the execution resource was not
stored properly if we needed to call into C++ to extend the stack size.
Fix that bug by always storing the resource.

Refs: #34319
Fixes: #34556

PR-URL: #34573
Reviewed-By: Andrey Pechkurov <apechkurov@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Gus Caplan <me@gus.host>
@puzpuzpuz
Copy link
Member

Landed in 2ba93e1

@puzpuzpuz puzpuzpuz closed this Aug 3, 2020
codebytere pushed a commit that referenced this pull request Aug 5, 2020
460c81d introduced a bug where the execution resource was not
stored properly if we needed to call into C++ to extend the stack size.
Fix that bug by always storing the resource.

Refs: #34319
Fixes: #34556

PR-URL: #34573
Reviewed-By: Andrey Pechkurov <apechkurov@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Gus Caplan <me@gus.host>
@codebytere codebytere mentioned this pull request Aug 10, 2020
codebytere pushed a commit that referenced this pull request Aug 11, 2020
460c81d introduced a bug where the execution resource was not
stored properly if we needed to call into C++ to extend the stack size.
Fix that bug by always storing the resource.

Refs: #34319
Fixes: #34556

PR-URL: #34573
Reviewed-By: Andrey Pechkurov <apechkurov@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Gus Caplan <me@gus.host>
@addaleax addaleax deleted the fix-34556 branch September 21, 2020 23:17
addaleax added a commit that referenced this pull request Sep 22, 2020
460c81d introduced a bug where the execution resource was not
stored properly if we needed to call into C++ to extend the stack size.
Fix that bug by always storing the resource.

Refs: #34319
Fixes: #34556

PR-URL: #34573
Reviewed-By: Andrey Pechkurov <apechkurov@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Gus Caplan <me@gus.host>
addaleax added a commit that referenced this pull request Sep 22, 2020
460c81d introduced a bug where the execution resource was not
stored properly if we needed to call into C++ to extend the stack size.
Fix that bug by always storing the resource.

Refs: #34319
Fixes: #34556

PR-URL: #34573
Reviewed-By: Andrey Pechkurov <apechkurov@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Gus Caplan <me@gus.host>
@codebytere codebytere mentioned this pull request Sep 28, 2020
abhishekumar-tyagi pushed a commit to abhishekumar-tyagi/node that referenced this pull request May 5, 2024
460c81d introduced a bug where the execution resource was not
stored properly if we needed to call into C++ to extend the stack size.
Fix that bug by always storing the resource.

Refs: nodejs/node#34319
Fixes: nodejs/node#34556

PR-URL: nodejs/node#34573
Reviewed-By: Andrey Pechkurov <apechkurov@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Gus Caplan <me@gus.host>
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. author ready PRs that have at least one approval, no pending requests for changes, and a CI started. review wanted PRs that need reviews.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AsyncLocalStorage: Cannot read property 'Symbol(kResourceStore)'
6 participants