src, test: node internals' postmortem metadata #14901
Conversation
Added two new commands (getactivehandles and getactiverequests) which prints all pending handles and requests (same return given by process._getActiveHandles() and process._getActiveRequests()). Those changes were built upon the symbols added on nodejs/node#14901, which means it's currently not working with node's latest build. Fixes: nodejs#100 Ref: nodejs/node#14901
|
The changes to src/ seem rather ad hoc. I'm also not a fan of adding global variables. You don't need to because the env can be found by following |
Sorry, something went wrong.
|
Thanks for the feedbacks, I just updated the PR with the suggestions made by @addaleax. I'm just not sure if All changes previously made on |
Sorry, something went wrong.
|
@bnoordhuis @mmarchini the isolate is a v8 class, the env is in node, and it looks to me that you could get the isolate from the env, but I don't see how you can go the other way? |
Sorry, something went wrong.
|
@rnchamberlain the Environment is stored in a fixed position inside the Context, and the Context is reachable from the Isolate, but the offsets to get the Context from the Isolate and the position inside the Context where the Environment is stored are currently not available in the symbols table of V8. I'm writing a PR to add those symbols to V8, let's see how it goes. Another option would be to get the environment from |
Sorry, something went wrong.
|
Pull Request updated:
Please let me know if there's any other changes needed. |
Sorry, something went wrong.
|
@nodejs/build @nodejs/post-mortem PTAL |
Sorry, something went wrong.
|
Again @nodejs/build @nodejs/post-mortem PTAL |
Sorry, something went wrong.
The code LGTM but I don’t think I have a sufficiently good feeling for the usefulness of this feature. |
Sorry, something went wrong.
8416bc4 to
dc9633f
Compare
September 20, 2017 00:34
|
Sorry for the late response. I've just updated the PR with changes requested by @bnoordhuis. I've also rebased it to match the current master. @addaleax for now, it can be used to inspect active handles and requests on debuggers like LLDB (nodejs/llnode#122) and MDB (not implemented yet, but certainly will be if this is accepted). As we were discussing in nodejs/post-mortem#46, this is a first step to increase the power of debuggers to do post-mortem analysis of Node applications. |
Sorry, something went wrong.
cjihrig
left a comment
There was a problem hiding this comment.
LGTM once @bnoordhuis is good with it.
Sorry, something went wrong.
bnoordhuis
left a comment
There was a problem hiding this comment.
LGTM if the last nits are addressed. Thanks for the PR.
Sorry, something went wrong.
|
Pull Request updated with those last changes requested |
Sorry, something went wrong.
Sorry, something went wrong.
|
@mmarchini the commits should at least partially quashed and it is somewhat difficult for me to describe your changes in a single commit as I do not know what of the commit messages is still relevant and what not. Would you mind to either provide a single commit messages for all commits together or rebase on your own so this can be landed? Thanks a lot in advance! |
Sorry, something went wrong.
28136f3 to
a7dfd9a
Compare
September 25, 2017 00:47
|
I've squashed all commits into one and updated the commit message to best reflect these changes. If you need anything else please let me know :) |
Sorry, something went wrong.
Sorry, something went wrong.
|
Rerun the CI as it is very red https://ci.nodejs.org/job/node-test-commit/12650/ |
Sorry, something went wrong.
|
@mmarchini it seems like there are related failures on the CI. Please have a look. E.g. https://ci.nodejs.org/job/node-test-commit-linux/12698/nodes=centos5-64/console |
Sorry, something went wrong.
|
Another one...:https://ci.nodejs.org/job/node-test-commit-arm/13371/ EDIT: no luck, stopped. |
Sorry, something went wrong.
|
CI before landing: https://ci.nodejs.org/job/node-test-pull-request/12738/ |
Sorry, something went wrong.
|
Landed in 756a34e, thanks for being so patient and following along! @mmarchini |
Sorry, something went wrong.
Before these changes, only V8 added postmortem metadata to Node's binary, limiting the possibilities for debugger's developers to add some features that rely on investigating Node's internal structures. These changes are first steps towards empowering debug tools to navigate Node's internal structures. One example of what can be achieved with this is shown at nodejs/llnode#122 (a command which prints information about handles and requests on the queue for a core dump file). Node postmortem metadata are prefixed with nodedbg_. This also adds tests to validate if all postmortem metadata are calculated correctly, plus some documentation on what is postmortem metadata and a few care to be taken to avoid breaking it. Ref: nodejs/llnode#122 Ref: nodejs/post-mortem#46 PR-URL: #14901 Refs: nodejs/post-mortem#46 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Added two new commands (getactivehandles and getactiverequests) which prints all pending handles and requests (same return given by process._getActiveHandles() and process._getActiveRequests()). Those changes were built upon the symbols added on nodejs/node#14901, which means it's currently not working with node's latest build. Fixes: nodejs#100 Ref: nodejs/node#14901
|
I just ran into an issue caused by the redefinition of |
Sorry, something went wrong.
|
@MSLaguana How would they be broken? Do you mean that their members are now all accessible to |
Sorry, something went wrong.
|
@MSLaguana Ah, right, I realized that you are talking about that the inheritance statement will be broken...that is unintentional I believe. |
Sorry, something went wrong.
|
It's of no concern since we don't use private inheritance. I don't foresee that happening either. |
Sorry, something went wrong.
|
@bnoordhuis Just curious, is that a convention? There is |
Sorry, something went wrong.
|
I saw that by pure coincidence ten minutes after I posted that... the reason we don't use non-public inheritance is that there is never a reason to. The two files you mention both came from outside. Yes, a note in the style guide would be good. |
Sorry, something went wrong.
|
One more thing... should this be semver-minor? |
Sorry, something went wrong.
AFAIK it's because there was one reverted commit here, see #14901 (comment) (this comment also explains why I opened a backport PR). |
Sorry, something went wrong.
Yep, since it's a new feature. |
Sorry, something went wrong.
|
@mmarchini thanks for pointing it out! We'll get it in the next release! |
Sorry, something went wrong.
|
Yes. There's already a backport PR open (#19176), I just need to rebase it to resolve conflicts. I'll do it today. |
Sorry, something went wrong.
Those changes are the first steps towards allowing debug tools to
navigate some of Node's internals strucutres, giving more possibilities
to developers doing post-mortem debugging. One example of what can be
achieved with the symbols added is a new command being developed for
llnode, which prints information about handles and requests on the
queue for a core dump file.
Ref: nodejs/post-mortem#46
Obs.: To add good tests for those changes, something like nodejs/build#777 is needed.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)