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

src: add support for ETW stack walking #46203

Merged

Conversation

jdapena
Copy link
Contributor

@jdapena jdapena commented Jan 13, 2023

V8 supports native stack walking in Windows by providing JIT code information to ETW (Event Tracing for Windows). But the option to enable it is not exposed in NodeJS.

Just add command line (and environment variable) support for --enable-etw-stack-walking, that maps to V8 option of the same name.

Fixes: #46202

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Jan 13, 2023
@bnoordhuis
Copy link
Member

Test failures are related.

We should probably formulate a strategy on NODE_OPTIONS vis-a-vis V8 options because there are tons of them. Adding them haphazardly is, let's say, suboptimal.

Having said that, --perf-basic-prof is already allowed so why not --enable-etw-stack-walking too?

V8 supports native stack walking in Windows by providing JIT code
information to ETW (Event Tracing for Windows). But the option to
enable it is not exposed in NodeJS.

Just add command line (and environment variable) support for
--enable-etw-stack-walking, that maps to V8 option of the same name.

Fixes: nodejs#46202
@jdapena jdapena force-pushed the node-issue-46202-etw-node-options branch from 5209e4a to e554fbd Compare January 18, 2023 16:27
@jdapena
Copy link
Contributor Author

jdapena commented Jan 18, 2023

Test failures are related.

We should probably formulate a strategy on NODE_OPTIONS vis-a-vis V8 options because there are tons of them. Adding them haphazardly is, let's say, suboptimal.

Most interesting thing is that passing any existing V8 flag in command line is already supported, and it will detect if the flag exists. But NODE_OPTIONS has stronger checks.

One possibility would be doing the same thing that is done with CLI arguments and accept any V8 flag. Another possibility is having something like --v8-flags="..." or similar that will pass the arguments to V8. It would be interesting to know why the environment checks are added (if it is just warning user about unsupported flags or security or what...).

Having said that, --perf-basic-prof is already allowed so why not --enable-etw-stack-walking too?

Yes, provisionally we can land this patch (with the extra documentation change I just added). And maybe create a new ticket for working the NODE_OPTIONS V8 flags processing.

@bnoordhuis
Copy link
Member

or security

That's the reason. With "formulating a strategy" I meant thinking about what flag categories should and should not be accepted.

Right now it's decided on a case-by-case basis but that often leaves glaring holes, like how --max-old-space-size=... was accepted but not --max-semi-space-size=... (fixed, but only recently.)

@jdapena
Copy link
Contributor Author

jdapena commented Jan 19, 2023

As first time contributor to Node, I cannot kick workflows for the updated patch 🤔

About creating a strategy for V8 flags... my first question is if this patch should wait for that.

Then, about how to implement an strategy (i.e. reworking NODE_OPTIONS processing to be more explicit that we have an "allow list", and which flags are allowed). And about functionality discussion... maybe we want to have some clear rules about what should be allowed or not.

@bnoordhuis
Copy link
Member

About creating a strategy for V8 flags... my first question is if this patch should wait for that.

No, that's for other maintainers to worry about. :-)

I cannot kick workflows for the updated patch

I'm kind of surprised by that because CI went through just fine the first time... I can start it manually but that's pointless when it's going the fail in the exact same way. Can you run make test locally and fix up the failures?

@nodejs-github-bot
Copy link
Collaborator

@joyeecheung joyeecheung added the commit-queue Add this label to land a pull request using GitHub Actions. label Jan 24, 2023
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jan 24, 2023
@nodejs-github-bot nodejs-github-bot merged commit b88628c into nodejs:main Jan 24, 2023
@nodejs-github-bot
Copy link
Collaborator

Landed in b88628c

@joyeecheung
Copy link
Member

I opened #46339 for the question:

We should probably formulate a strategy on NODE_OPTIONS vis-a-vis V8 options because there are tons of them. Adding them haphazardly is, let's say, suboptimal.

ruyadorno pushed a commit that referenced this pull request Feb 1, 2023
V8 supports native stack walking in Windows by providing JIT code
information to ETW (Event Tracing for Windows). But the option to
enable it is not exposed in NodeJS.

Just add command line (and environment variable) support for
--enable-etw-stack-walking, that maps to V8 option of the same name.

Fixes: #46202
PR-URL: #46203
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
@ruyadorno ruyadorno mentioned this pull request Feb 1, 2023
juanarbol pushed a commit that referenced this pull request Mar 3, 2023
V8 supports native stack walking in Windows by providing JIT code
information to ETW (Event Tracing for Windows). But the option to
enable it is not exposed in NodeJS.

Just add command line (and environment variable) support for
--enable-etw-stack-walking, that maps to V8 option of the same name.

Fixes: #46202
PR-URL: #46203
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
@juanarbol juanarbol mentioned this pull request Mar 3, 2023
juanarbol pushed a commit that referenced this pull request Mar 5, 2023
V8 supports native stack walking in Windows by providing JIT code
information to ETW (Event Tracing for Windows). But the option to
enable it is not exposed in NodeJS.

Just add command line (and environment variable) support for
--enable-etw-stack-walking, that maps to V8 option of the same name.

Fixes: #46202
PR-URL: #46203
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ETW stack walking cannot be enabled from NODE_OPTIONS
4 participants