-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
[WIP] add node-report to core #19661
Conversation
Adding node-report to core is definitely the right direction but I do believe that it still ought to be an opt-in to use. (the example in the post above suggests that it's potentially always enabled) |
I agree with @jasnell , for now we should enable it only with |
ack. I'm leaning towards something like Currently working on updating the update script to pull node-report from GitHub instead of npm because we don't publish node-report's tests to npm. |
tools/update-node-report.sh
Outdated
cd node-report-tmp | ||
npm init --yes | ||
|
||
npm install --global-style --no-bin-links --production --no-package-lock --ignore-scripts node-report@latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to change to pull from GitHub because we don't publish node-report's tests to npm.
@joyeecheung re your comment in #19903, would enabling this in our tests mean simply adding a cmdline flag to all executions of |
@rvagg I meant adding the Flags: comment in flaky tests that crash with fatal errors (I assume we will provide a CLi option to enable node-report) It would be helpful to get the report for those tests if the immediate output to stderr does not provide enough context. |
@rvagg Although if we are just setting handlers I guess that would not bring too much overhead...except when someone submit a CI that simply fails, then we will be flooded by reports if it is enabled on all tests |
@richardlau - just wanted to know how is this progressing, and if there are any challenges. please let me know if I can be of some help, including fixing any current issues or working on any pending items, thanks! |
967b81e
to
c54ebfd
Compare
@gireeshpunathil Thanks for the prompt. I've pushed the current state of my workspace -- This is still very much WIP and the latest commit contains some temporary debugging output (which will make non-related tests that test stdout/stderr to fail as they won't be expecting the extra output). When I started this PR I had the belief that we could take the source code from https://github.com/nodejs/node-report and drop it into core with minimal tweaking, with a view to keeping the codebases in sync. I'm slowly coming round to believing this is not practical and that we would be better served severing the direct link between the module (https://github.com/nodejs/node-report) and the code that ends up in core based on the hacks I've had to do so far. For example, if you run the added Things like nodejs/node-report#113 are also more easily solved if node-report is in core rather than the stand-alone module since the code in core would only have to deal with the version of Node.js it is in whereas the module has to support all LTS versions (for this reason the standalone module uses |
@richardlau - thanks for the explanation. let me set my basics right: reviewing your first wave of changes, I believe the design is to retain https://github.com/nodejs/node-report as Given that |
Yes, that was my original thought. The idea was that we could then slowly transition over to the code in core once integrated (we would still have LTS releases that would need the module unless of course we backport).
Yes, this is what I meant by "severing the direct link between the module (https://github.com/nodejs/node-report) and the code that ends up in core". By "retire the module from npm registry" we would just not update it (or update it infrequently) -- there are other modules currently depending on the node-report module (https://www.npmjs.com/package/node-report?activeTab=dependents).
"The node-report project falls under the governance of the post-mortem working group". Note though that there is a proposal to fold the Post-mortem WG into the Diagnostics WG (nodejs/TSC#586). |
thanks @richardlau - this makes perfect sense. Yes, I see your proposal on So anticipating that post-mortem will fold into diagnostics and diagnostics will endorse the intent of this PR, the most appropriate direction seems to be to port node-report natively into core. I will take a look at your last set of changes and see where are we. |
}, | ||
], | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we still need this? can't we accommodate the procedures in node.gyp?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's not needed. It's not actually used in the core build (see changes to node.gyp
).
This was pulled in by the tools/update-node-report.sh
script -- The original intention was to periodically update the source in core from the module and the script was added first to do so. Other than running dmn
no other clean up is done in the script (no reason not to but then if we're breaking the direct link between the module and the code in core the update script is unnecessary).
exports.setSignal = api.setSignal; | ||
exports.setFileName = api.setFileName; | ||
exports.setDirectory = api.setDirectory; | ||
exports.setVerbose = api.setVerbose; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will these be exported here, as opposed to util
module as suggested by other reviewers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this file is not used in core. At the moment no JS api is implemented in core.
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we eliminate the need for nan
altogether and work directly with v8? following other Node.js absrtactions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. In fact if we're breaking the link between the module and the code in core there is no reason to use nan
and can work directly with V8.
Long term we might look at using n-api.
"devDependencies": { | ||
"tap": "^8.0.0" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we elevate
the version number to node_version.h
and eliminate the need for this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my opinion once this is in core and there is no longer a link to the module node-report doesn't require a version because it is no longer a dependency (i.e. it versions with the version of Node.js that is released).
report_events.replace(c, 1, "+"); | ||
c = report_events.find_first_of(",", c + 1); | ||
} | ||
fprintf(stderr, "filtered events %s \n", report_events.c_str()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we have a default value for --report-events
? i.e., in case if user specifies this flag but no values, how about picking the most relevant trace events and feed those into report_events
filed?
raise Exception('Could not find pattern matching %s' % regex) | ||
|
||
if __name__ == '__main__': | ||
print(get_version()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as suggested earlier, if we are porting natively, can we eliminate this altogether, and record the version statically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my opinion once this is in core and there is no longer a link to the module node-report doesn't require a version because it is no longer a dependency (i.e. it versions with the version of Node.js that is released).
reports can be triggered on unhandled exceptions, fatal errors, signals | ||
and calls to a JavaScript API. | ||
|
||
Supports Node.js versions 4, 6 and 8 on AIX, Linux, MacOS, SmartOS and Windows. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably change this to reflect in which versions it is available in core and in which versions to use external package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'd drop this readme (but we do need to add some sort of documentation).
## Usage | ||
|
||
```bash | ||
npm install node-report |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
irrelevant now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'd drop this readme (but we do need to add some sort of documentation).
|
||
```bash | ||
npm install node-report | ||
node -r node-report app.js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-r -> --report_events ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'd drop this readme (but we do need to add some sort of documentation).
application. | ||
|
||
```js | ||
var nodereport = require('node-report'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we are launching with --report-events
do we still need the require?
if the JS interface is going to util
package, what the require()
will return?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'd drop this readme (but we do need to add some sort of documentation).
Left some comments. Predominantly it is all pointing at the level of fusing we wanted and how much we want to baseline on the upstream. For example:
|
@gireeshpunathil I'm leaning towards eliminating Using Activating |
Make node-report part of core runtime, to satisfy its tier1 status on diagnostic tooling. No new functionalities have been added, changes that are required for melding it as a built-in capability has been affected on the module version of node-report (https://github.com/nodejs/node-report) Refs: nodejs#19661 Refs: nodejs#18760 Refs: nodejs/node-report#103
Make node-report part of core runtime, to satisfy its tier1 status on diagnostic tooling. No new functionalities have been added, changes that are required for melding it as a built-in capability has been affected on the module version of node-report (https://github.com/nodejs/node-report) Refs: nodejs#19661 Refs: nodejs#18760 Refs: nodejs/node-report#103
Make node-report part of core runtime, to satisfy its tier1 status on diagnostic tooling. No new functionalities have been added, changes that are required for melding it as a built-in capability has been affected on the module version of node-report (https://github.com/nodejs/node-report) Refs: nodejs#19661 Refs: nodejs#18760 Refs: nodejs/node-report#103
Make node-report part of core runtime, to satisfy its tier1 status on diagnostic tooling. No new functionalities have been added, changes that are required for melding it as a built-in capability has been affected on the module version of node-report (https://github.com/nodejs/node-report) Refs: nodejs#19661 Refs: nodejs#18760 Refs: nodejs/node-report#103
Closing in favor of #22712. |
This is very early proof-of-concept attempt to add node-report to core, on the basis that it is easier to critique something that exists. It's nowhere near ready to land. I'm not sure how much time I'll get to work on this over Easter, so am submitting what I currently have for comments.
I've started on the basis that we keep node-report as a module so that it can be used with older versions of Node.js, and as such aimed to keep modifications to node-report itself to a minimum (commits prefixed
node-report:
don't really belong here and ultimately should be upstreamed if this is the direction we want to take).Currently what I have builds on Linux and sets up node-report to trigger on fatal errors and signals (SIGUSR2). Tested in the repl:
Obviously needs tests (I have an idea on how to adapt the existing node-report tests by mocking enough of the tap module's interface with core's assert to use with https://github.com/nodejs/node-report/blob/master/test/common.js).
Refs: #18760
Refs: nodejs/node-report#103
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes