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

util: integrate node-heapdump into core #26501

Closed
wants to merge 2 commits into from

Conversation

@jasnell
Copy link
Member

commented Mar 7, 2019

Adds v8.heapdump.getHeapdump() and v8.heapdump.triggerHeapdump(filename) methods with impl adapted from the node-heapdump module.

Not included is the SIGUSR2 signal, which can be handled by userland.

/cc nodejs/diagnostics#279
@nodejs/diagnostics

Also see: #26498

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Show resolved Hide resolved doc/api/v8.md Outdated
Show resolved Hide resolved doc/api/v8.md Outdated
Show resolved Hide resolved doc/api/v8.md Outdated
Show resolved Hide resolved tools/license-builder.sh Outdated
@mcollina
Copy link
Member

left a comment

Code LGTM

v8.heapdump.getHeapdump() data format is missing in the docs.

Show resolved Hide resolved doc/api/v8.md Outdated
@jasnell

This comment has been minimized.

Copy link
Member Author

commented Mar 8, 2019

Based on some conversations around this, I'm considering just removing the getHeapdump() option and just keeping the write-to-disk option only.

Show resolved Hide resolved doc/api/v8.md Outdated

@cjihrig cjihrig referenced this pull request Mar 8, 2019

Merged

report: rename triggerReport() to writeReport() #26527

4 of 4 tasks complete

@jasnell jasnell force-pushed the jasnell:heapdump branch from 0890c08 to af77a99 Mar 9, 2019

@jasnell

This comment has been minimized.

Copy link
Member Author

commented Mar 9, 2019

Updated the PR to:

  1. Remove the getHeapdump() function
  2. Added a note indicating that the heapdump file format is V8 specific and intended to be loaded in tools like Chrome DevTools
  3. Added a note about heapdumps being isolate/thread specific along with an example of taking heapdumps of the main thread and worker threads.
  4. Since there is only the one method, changed from v8.heapdump.triggerHeapdump() to just v8.triggerHeapdump()

@bnoordhuis and @richardlau ... may I ask you both to reaffirm your sign-off with the updates.

@mcollina ... may I ask you to review the doc updates to see if they address your concerns.

Show resolved Hide resolved src/heap_utils.cc
Show resolved Hide resolved src/heap_utils.cc Outdated
Show resolved Hide resolved tools/license-builder.sh
@mcollina
Copy link
Member

left a comment

LGTM

@jasnell

This comment has been minimized.

Copy link
Member Author

commented Mar 9, 2019

Show resolved Hide resolved doc/api/v8.md Outdated
@vsemozhetbyt
Copy link
Member

left a comment

Some doc nits.

Show resolved Hide resolved doc/api/v8.md Outdated
Show resolved Hide resolved doc/api/v8.md Outdated
Show resolved Hide resolved doc/api/v8.md Outdated
Show resolved Hide resolved doc/api/v8.md Outdated
Show resolved Hide resolved doc/api/v8.md Outdated

@vsemozhetbyt vsemozhetbyt added the memory label Mar 9, 2019

@jasnell jasnell force-pushed the jasnell:heapdump branch from 6fe05dd to f7bb696 Mar 10, 2019

@jasnell

This comment has been minimized.

Copy link
Member Author

commented Mar 10, 2019

@joyeecheung ... PTAL, I added a getHeapdump() variant that returns a stream.Readable

Show resolved Hide resolved doc/api/v8.md Outdated
Show resolved Hide resolved doc/api/v8.md Outdated
Show resolved Hide resolved src/heap_utils.cc Outdated
Show resolved Hide resolved src/heap_utils.cc Outdated
Show resolved Hide resolved src/heap_utils.cc Outdated
Show resolved Hide resolved src/heap_utils.cc Outdated
Show resolved Hide resolved doc/api/v8.md Outdated

@jasnell jasnell force-pushed the jasnell:heapdump branch from f7bb696 to 73ac155 Mar 11, 2019

@jasnell

This comment has been minimized.

Copy link
Member Author

commented Mar 11, 2019

@jasnell

This comment has been minimized.

Copy link
Member Author

commented Mar 11, 2019

@sam-github

This comment has been minimized.

Copy link
Member

commented Mar 12, 2019

@jasnell Unless heap "dumps" are different from heap "snapshots", I suggest you either s/Dump/Snapshot/, or the other way around. Using multiple names for the same thing is confusing.

v8: integrate node-heapdump into core
Adds `v8.writeHeapSnapshot(filename)` with impl adapted
from the `node-heapdump` module.

Also, adds a v8.getHeapSnapshot() alternative that returns a Readable Stream

@jasnell jasnell force-pushed the jasnell:heapdump branch from b4c7696 to 8124e76 Mar 12, 2019

@jasnell

This comment has been minimized.

Copy link
Member Author

commented Mar 12, 2019

CI is good

Show resolved Hide resolved lib/v8.js Outdated
Show resolved Hide resolved src/heap_utils.cc Outdated
@jasnell

This comment has been minimized.

Copy link
Member Author

commented Mar 13, 2019

Ok @joyeecheung ... hopefully that'll be the last few nits fixed. This should be ready to go.

@addaleax

This comment has been minimized.

@joyeecheung
Copy link
Member

left a comment

LGTM. Thanks for following up with the reviews!

@jasnell

This comment has been minimized.

Copy link
Member Author

commented Mar 13, 2019

jasnell added a commit that referenced this pull request Mar 13, 2019

v8: integrate node-heapdump into core
Adds `v8.writeHeapSnapshot(filename)` with impl adapted
from the `node-heapdump` module.

Also, adds a v8.getHeapSnapshot() alternative that returns
a Readable Stream

PR-URL: #26501
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
@jasnell

This comment has been minimized.

Copy link
Member Author

commented Mar 13, 2019

Landed in 5f38797 ... thanks all

@jasnell jasnell closed this Mar 13, 2019

richardlau added a commit to richardlau/node-1 that referenced this pull request Mar 15, 2019

lib: lazy load `v8` in error-serdes
Lazy loading `v8` in `lib/internal/error-serdes.js` reduces the number
of loaded modules by the bootstrap code for Worker threads by five.

Refs: nodejs#26501 (comment)

@richardlau richardlau referenced this pull request Mar 15, 2019

Closed

lib: lazy load `v8` in error-serdes #26689

2 of 2 tasks complete

richardlau added a commit to richardlau/node-1 that referenced this pull request Mar 15, 2019

lib: lazy load `v8` in error-serdes
Lazy loading `v8` in `lib/internal/error-serdes.js` reduces the number
of loaded modules by the bootstrap code for Worker threads by seven.

Refs: nodejs#26501 (comment)

pull bot pushed a commit to SimenB/node that referenced this pull request Mar 19, 2019

lib: lazy load `v8` in error-serdes
Lazy loading `v8` in `lib/internal/error-serdes.js` reduces the number
of loaded modules by the bootstrap code for Worker threads by seven.

PR-URL: nodejs#26689
Refs: nodejs#26501 (comment)
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>

Drieger added a commit to Drieger/node that referenced this pull request Mar 22, 2019

v8: integrate node-heapdump into core
Adds `v8.writeHeapSnapshot(filename)` with impl adapted
from the `node-heapdump` module.

Also, adds a v8.getHeapSnapshot() alternative that returns
a Readable Stream

PR-URL: nodejs#26501
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>

targos added a commit to targos/node that referenced this pull request Mar 27, 2019

v8: integrate node-heapdump into core
Adds `v8.writeHeapSnapshot(filename)` with impl adapted
from the `node-heapdump` module.

Also, adds a v8.getHeapSnapshot() alternative that returns
a Readable Stream

PR-URL: nodejs#26501
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>

targos added a commit to targos/node that referenced this pull request Mar 27, 2019

v8: integrate node-heapdump into core
Adds `v8.writeHeapSnapshot(filename)` with impl adapted
from the `node-heapdump` module.

Also, adds a v8.getHeapSnapshot() alternative that returns
a Readable Stream

PR-URL: nodejs#26501
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>

targos added a commit to targos/node that referenced this pull request Mar 27, 2019

v8: integrate node-heapdump into core
Adds `v8.writeHeapSnapshot(filename)` with impl adapted
from the `node-heapdump` module.

Also, adds a v8.getHeapSnapshot() alternative that returns
a Readable Stream

PR-URL: nodejs#26501
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>

targos added a commit that referenced this pull request Mar 27, 2019

lib: lazy load `v8` in error-serdes
Lazy loading `v8` in `lib/internal/error-serdes.js` reduces the number
of loaded modules by the bootstrap code for Worker threads by seven.

PR-URL: #26689
Refs: #26501 (comment)
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>

targos added a commit that referenced this pull request Mar 27, 2019

2019-03-28, Version 11.13.0 (Current)
Notable changes:

* events:
  * Added a `once` function to use `EventEmitter` with promises
    (#26078).
* tty:
  * Added a `hasColors` method to `WriteStream`
    (#26247).
  * Added NO_COLOR and FORCE_COLOR support
    (#26485).
* v8:
  * Added `v8.getHeapSnapshot` and `v8.writeHeapSnapshot` to generate snapshots
    in the format used by tools such as Chrome DevTools
    (#26501).
* meta:
  * Gireesh Punathil is now a member of the Technical Steering Committee
    (#26657).
  * Added ZYSzys to collaborators (#26730).

targos added a commit that referenced this pull request Mar 27, 2019

2019-03-28, Version 11.13.0 (Current)
Notable changes:

* events:
  * Added a `once` function to use `EventEmitter` with promises
    (#26078).
* tty:
  * Added a `hasColors` method to `WriteStream`
    (#26247).
  * Added NO_COLOR and FORCE_COLOR support
    (#26485).
* v8:
  * Added `v8.getHeapSnapshot` and `v8.writeHeapSnapshot` to generate snapshots
    in the format used by tools such as Chrome DevTools
    (#26501).
* meta:
  * Gireesh Punathil is now a member of the Technical Steering Committee
    (#26657).
  * Added ZYSzys to collaborators (#26730).

PR-URL: #26949

@targos targos referenced this pull request Mar 27, 2019

Merged

v11.13.0 release proposal #26949

targos added a commit that referenced this pull request Mar 28, 2019

2019-03-28, Version 11.13.0 (Current)
Notable changes:

* crypto
  * Allow deriving public from private keys (Tobias Nießen)
    [#26278](#26278).
* events
  * Added a `once` function to use `EventEmitter` with promises
    (Matteo Collina) [#26078](#26078).
* tty
  * Added a `hasColors` method to `WriteStream` (Ruben Bridgewater)
    [#26247](#26247).
  * Added NO_COLOR and FORCE_COLOR support (Ruben Bridgewater)
    [#26485](#26485).
* v8
  * Added `v8.getHeapSnapshot` and `v8.writeHeapSnapshot` to generate snapshots
    in the format used by tools such as Chrome DevTools (James M Snell)
    [#26501](#26501).
* worker
  * Added `worker.moveMessagePortToContext`. This enables using MessagePorts in
    different vm.Contexts, aiding with the isolation that the vm module seeks to
    provide (Anna Henningsen)
    [#26497](#26497).
* C++ API
  * `AddPromiseHook` is now deprecated. This API was added to fill an use case
    that is served by `async_hooks`, since that has `Promise` support
    (Anna Henningsen) [#26529](#26529).
  * Added a `Stop` API to shut down Node.js while it is running
    (Gireesh Punathil) [#21283](#21283).
* meta
  * [Gireesh Punathil](https://github.com/gireeshpunathil) is now a member of
    the Technical Steering Committee
    [#26657](#26657).
  * Added [Yongsheng Zhang](https://github.com/ZYSzys) to collaborators
    [#26730](#26730).

PR-URL: #26949

targos added a commit that referenced this pull request Mar 28, 2019

2019-03-28, Version 11.13.0 (Current)
Notable changes:

* crypto
  * Allow deriving public from private keys (Tobias Nießen)
    [#26278](#26278).
* events
  * Added a `once` function to use `EventEmitter` with promises
    (Matteo Collina) [#26078](#26078).
* tty
  * Added a `hasColors` method to `WriteStream` (Ruben Bridgewater)
    [#26247](#26247).
  * Added NO_COLOR and FORCE_COLOR support (Ruben Bridgewater)
    [#26485](#26485).
* v8
  * Added `v8.getHeapSnapshot` and `v8.writeHeapSnapshot` to generate snapshots
    in the format used by tools such as Chrome DevTools (James M Snell)
    [#26501](#26501).
* worker
  * Added `worker.moveMessagePortToContext`. This enables using MessagePorts in
    different vm.Contexts, aiding with the isolation that the vm module seeks to
    provide (Anna Henningsen)
    [#26497](#26497).
* C++ API
  * `AddPromiseHook` is now deprecated. This API was added to fill an use case
    that is served by `async_hooks`, since that has `Promise` support
    (Anna Henningsen) [#26529](#26529).
  * Added a `Stop` API to shut down Node.js while it is running
    (Gireesh Punathil) [#21283](#21283).
* meta
  * [Gireesh Punathil](https://github.com/gireeshpunathil) is now a member of
    the Technical Steering Committee
    [#26657](#26657).
  * Added [Yongsheng Zhang](https://github.com/ZYSzys) to collaborators
    [#26730](#26730).

PR-URL: #26949

BethGriggs added a commit that referenced this pull request Apr 5, 2019

2019-03-28, Version 11.13.0 (Current)
Notable changes:

* crypto
  * Allow deriving public from private keys (Tobias Nießen)
    [#26278](#26278).
* events
  * Added a `once` function to use `EventEmitter` with promises
    (Matteo Collina) [#26078](#26078).
* tty
  * Added a `hasColors` method to `WriteStream` (Ruben Bridgewater)
    [#26247](#26247).
  * Added NO_COLOR and FORCE_COLOR support (Ruben Bridgewater)
    [#26485](#26485).
* v8
  * Added `v8.getHeapSnapshot` and `v8.writeHeapSnapshot` to generate snapshots
    in the format used by tools such as Chrome DevTools (James M Snell)
    [#26501](#26501).
* worker
  * Added `worker.moveMessagePortToContext`. This enables using MessagePorts in
    different vm.Contexts, aiding with the isolation that the vm module seeks to
    provide (Anna Henningsen)
    [#26497](#26497).
* C++ API
  * `AddPromiseHook` is now deprecated. This API was added to fill an use case
    that is served by `async_hooks`, since that has `Promise` support
    (Anna Henningsen) [#26529](#26529).
  * Added a `Stop` API to shut down Node.js while it is running
    (Gireesh Punathil) [#21283](#21283).
* meta
  * [Gireesh Punathil](https://github.com/gireeshpunathil) is now a member of
    the Technical Steering Committee
    [#26657](#26657).
  * Added [Yongsheng Zhang](https://github.com/ZYSzys) to collaborators
    [#26730](#26730).

PR-URL: #26949
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.