node-oom-heapdump 2.1.0-progress.1 → 3.0.1-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +2 -2
- package/.travis.yml +13 -9
- package/CHANGELOG.md +107 -84
- package/LICENSE +21 -21
- package/README.md +129 -143
- package/build/binding.sln +19 -0
- package/build/node_oom_heapdump_native.vcxproj +145 -0
- package/build/node_oom_heapdump_native.vcxproj.filters +14 -0
- package/index.js +112 -133
- package/lib/cpuProfileWorker.js +48 -48
- package/lib/heapdumpWorker.js +48 -48
- package/lib/index.js +186 -227
- package/package.json +40 -51
- package/.github/workflows/publish-native-assets-to-github-releases.yml +0 -37
- package/binding.gyp +0 -10
- package/build/Makefile +0 -324
- package/build/binding.Makefile +0 -6
- package/build/node_oom_heapdump_native.target.mk +0 -157
- package/lib/node_oom_heapdump_native.cc +0 -110
- package/tests/index.js +0 -27
- package/tests/long_running_process.js +0 -27
- package/tests/long_running_process_cpu.js +0 -35
- package/tests/oom_app.js +0 -22
package/.eslintrc.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
module.exports = {
|
2
|
-
"extends": "google"
|
1
|
+
module.exports = {
|
2
|
+
"extends": "google"
|
3
3
|
};
|
package/.travis.yml
CHANGED
@@ -1,9 +1,13 @@
|
|
1
|
-
language: node_js
|
2
|
-
node_js:
|
3
|
-
- "7"
|
4
|
-
- "8"
|
5
|
-
- "9"
|
6
|
-
- "10"
|
7
|
-
- "11"
|
8
|
-
- "12"
|
9
|
-
|
1
|
+
language: node_js
|
2
|
+
node_js:
|
3
|
+
- "7"
|
4
|
+
- "8"
|
5
|
+
- "9"
|
6
|
+
- "10"
|
7
|
+
- "11"
|
8
|
+
- "12"
|
9
|
+
- "13"
|
10
|
+
- "14"
|
11
|
+
- "15"
|
12
|
+
- "16"
|
13
|
+
script: npm run dummy
|
package/CHANGELOG.md
CHANGED
@@ -1,84 +1,107 @@
|
|
1
|
-
|
2
|
-
-
|
3
|
-
-
|
4
|
-
|
5
|
-
|
6
|
-
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
-
|
15
|
-
|
16
|
-
-
|
17
|
-
|
18
|
-
-
|
19
|
-
|
20
|
-
02-
|
21
|
-
-
|
22
|
-
-
|
23
|
-
|
24
|
-
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
-
|
29
|
-
-
|
30
|
-
-
|
31
|
-
|
32
|
-
|
33
|
-
- 1.
|
34
|
-
|
35
|
-
|
36
|
-
-
|
37
|
-
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
-
|
42
|
-
|
43
|
-
-
|
44
|
-
|
45
|
-
|
46
|
-
-
|
47
|
-
-
|
48
|
-
|
49
|
-
|
50
|
-
-
|
51
|
-
|
52
|
-
|
53
|
-
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
-
|
61
|
-
|
62
|
-
|
63
|
-
-
|
64
|
-
|
65
|
-
|
66
|
-
-
|
67
|
-
|
68
|
-
|
69
|
-
- 1.0.
|
70
|
-
|
71
|
-
|
72
|
-
-
|
73
|
-
|
74
|
-
|
75
|
-
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
1
|
+
09-02-2022 Paul Rütter
|
2
|
+
- 3.0.0
|
3
|
+
- Updated dependencies to resolve https://github.com/blueconic/node-oom-heapdump/issues/19
|
4
|
+
- Removed `gc-stats` as it was not used a lot anymore (breaking change) and contained security issues.
|
5
|
+
- Removed creating heapdumps on out of memory, as this is superseeded by native node functionality.
|
6
|
+
- Remove unused dependencies and native code.
|
7
|
+
|
8
|
+
21-12-2020 Paul Rütter
|
9
|
+
- 2.2.0
|
10
|
+
- Updated ini
|
11
|
+
|
12
|
+
12-10-2020 Paul Rütter
|
13
|
+
- 2.1.0
|
14
|
+
- Added Node 14 support
|
15
|
+
|
16
|
+
12-10-2020 Paul Rütter
|
17
|
+
- 2.0.2
|
18
|
+
- Fix latest published version, was replaced with beta.
|
19
|
+
|
20
|
+
02-08-2020 Paul Rütter
|
21
|
+
- 2.0.1
|
22
|
+
- Fixed prebuilt binaries path.
|
23
|
+
|
24
|
+
20-07-2020 Paul Rütter
|
25
|
+
- 2.0
|
26
|
+
- Added prebuilt binaries again, in a new major version. To "solve" https://github.com/blueconic/node-oom-heapdump/issues/13.
|
27
|
+
|
28
|
+
20-07-2020 Paul Rütter
|
29
|
+
- 1.3.1
|
30
|
+
- Revert prebuilt binaries, since it's a breaking change.
|
31
|
+
|
32
|
+
24-06-2020 Stuart Miller / Paul Rütter
|
33
|
+
- 1.3.0
|
34
|
+
- Stuart Miller added support for having prebuilt binaries for all supported Node.js versions.
|
35
|
+
|
36
|
+
16-10-2019 Paul Rütter
|
37
|
+
- 1.2.0
|
38
|
+
- Node 12 support.
|
39
|
+
- Still some deprecated API's are used, which should be avoided.
|
40
|
+
See https://github.com/joyeecheung/node/blob/v8-maybe-doc/CPP_STYLE_GUIDE.md#use-maybe-version-of-v8-apis
|
41
|
+
- Adjusted test script a bit, by removing some flags which seem to complicate nodejs 12 support.
|
42
|
+
|
43
|
+
02-09-2019 Paul Rütter
|
44
|
+
- 1.2.0-beta.0
|
45
|
+
- Updated dependencies (nan update is needed for nodejs 12)
|
46
|
+
- Add nodejs 12 to travis
|
47
|
+
- Add experimental node 12 support. Still some deprecated API's are used, which should be avoided.
|
48
|
+
See https://github.com/joyeecheung/node/blob/v8-maybe-doc/CPP_STYLE_GUIDE.md#use-maybe-version-of-v8-apis
|
49
|
+
|
50
|
+
02-01-2019 Paul Rütter
|
51
|
+
- 1.1.4
|
52
|
+
- Updated dependencies
|
53
|
+
- Add travis file to trigger a build. Just run a dummy script which does nothing; the default "npm install" will check if the native module compiles.
|
54
|
+
|
55
|
+
09-06-2018 Paul Rütter
|
56
|
+
- 1.1.3 - Updated dependencies, to mitigate security issues.
|
57
|
+
|
58
|
+
02-20-2018 Paul Rütter
|
59
|
+
- 1.1.2 - Fixed heapdump generation on Unix machines.
|
60
|
+
- Added option to use the "old" implementation (GCmonitoring), as the new implementatuion is more prone to run in with the OoM killer when in memory restricted environments (like Docker). The old implementation was less impacted by this, because the "threshold" parameter can be used to create the heapdump earlier.
|
61
|
+
You can specify which OoM implementation to use, either: "NATIVE_HOOK" (default) or "GC_MONITORING" (old implementation).
|
62
|
+
|
63
|
+
02-19-2018 Paul Rütter
|
64
|
+
- 1.1.0 - Changed the way the "out of memory" heapdump is created, based on the work of 'trevnorris' (https://github.com/trevnorris/node-ofe/blob/master/ofe.cc). Using V8 engine isolate.SetOOMErrorHandler() to hook in on the out of memory event.
|
65
|
+
- Updated readme and removed deprecated 'limit' and 'threshold' parameters.
|
66
|
+
- Removed 'gc-stats' module, as we no longer need it with the native C++ add-on.
|
67
|
+
|
68
|
+
02-13-2018 - Paul Rütter
|
69
|
+
- 1.0.12 - Use 'require-main-filename' instead of require.main.filename, to resolve 'https://github.com/blueconic/node-oom-heapdump/issues/3'.
|
70
|
+
- Upgrade dependencies
|
71
|
+
|
72
|
+
11-21-2017 - Paul Rütter
|
73
|
+
- 1.0.11 - Added port verification; when the module is loaded, the configured WebSocket port is verified. If the websocket responds with ECONNREFUSED, the process might have been started without the --inspect flag.
|
74
|
+
|
75
|
+
11-17-2017 - Paul Rütter
|
76
|
+
- 1.0.10 - Use gc-stats to calculate when to make a OoM heapdumo instead of process.memoryUsage() as this memory information (heapTotal) is growing over time, which is not expected.
|
77
|
+
- Stringify gc-stats output, so it runs over only 1 line.
|
78
|
+
|
79
|
+
06-10-2017 - Paul Rütter
|
80
|
+
- 1.0.9 - Handle exit codes better and reject promise if so.
|
81
|
+
|
82
|
+
05-10-2017 - Paul Rütter
|
83
|
+
- 1.0.8 - Add CPU profile functionality.
|
84
|
+
|
85
|
+
04-10-2017 - Paul Rütter
|
86
|
+
- 1.0.7 - Add addTimestamp option.
|
87
|
+
|
88
|
+
04-10-2017 - Paul Rütter
|
89
|
+
- 1.0.6 - Add limit option.
|
90
|
+
|
91
|
+
03-10-2017 - Paul Rütter
|
92
|
+
- 1.0.5 - Change heap calculation.
|
93
|
+
|
94
|
+
03-10-2017 - Paul Rütter
|
95
|
+
- 1.0.4 - Add error handler in case the calling process is not running anymore. Also, block execution a while to allow heapdump to be created.
|
96
|
+
|
97
|
+
01-10-2017 - Paul Rütter
|
98
|
+
- 1.0.3 - Minor doc changes.
|
99
|
+
|
100
|
+
01-10-2017 - Paul Rütter
|
101
|
+
- 1.0.2 - Refactored code; split up API and implementation. Also added API for creating heapdumps on the fly. Documentation updated.
|
102
|
+
|
103
|
+
29-09-2017 - Paul Rütter
|
104
|
+
- 1.0.1 - minor changed
|
105
|
+
|
106
|
+
29-09-2017 - Paul Rütter
|
107
|
+
- 1.0.1 - initial version
|
package/LICENSE
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
MIT License
|
2
|
-
|
3
|
-
Copyright (c) 2017 BlueConic
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
13
|
-
copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE.
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2017 BlueConic
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
@@ -1,143 +1,129 @@
|
|
1
|
-
[](https://travis-ci.org/blueconic/node-oom-heapdump)
|
2
|
-
|
3
|
-
# node-oom-heapdump
|
4
|
-
Node module
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
```
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
*
|
70
|
-
*
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
});
|
81
|
-
|
82
|
-
/**
|
83
|
-
*
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
*
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
*
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
* @param {String} cpuProfilePath - path to the CPU profile to delete from disk
|
131
|
-
* @return {Promise}
|
132
|
-
*/
|
133
|
-
nodeOomHeapdump.deleteCpuProfile(cpuProfilePath);
|
134
|
-
```
|
135
|
-
|
136
|
-
# Known issues and limitations
|
137
|
-
|
138
|
-
## Memory usage
|
139
|
-
When creating a heapdump on request, it's notorious for using a lot of memory. This is caused by a bug in V8/DevTools protocol and is reported here (https://bugs.chromium.org/p/chromium/issues/detail?id=768355); the protocol has no backpressure mechanism, which causes the heapdump to be pushed faster than the DevTools client can handle, causing in-memory buffering.
|
140
|
-
|
141
|
-
This is not a problem if your server/machine has memory to spare, but can cause issues in memory restricted environments like a Docker container. Once the process exceeds the container memory threshold, it will be killed by OoMKiller (if enabled). This leads to an empty heapsnapshot file (0 bytes).
|
142
|
-
|
143
|
-
Please vote for that issue to be fixed!
|
1
|
+
[](https://travis-ci.org/blueconic/node-oom-heapdump)
|
2
|
+
|
3
|
+
# node-oom-heapdump
|
4
|
+
Node module that can create heapdumps and CPU profiles on request like 'v8-profiler', but does this off-process so it doesn't interfere with execution of the main process.
|
5
|
+
|
6
|
+
Tested on Node.js 7.x, 8.x, 9.x, 10.x, 11.x, 12.x, 13.x, 14.x and 16.x.
|
7
|
+
No support for Node.js < 7.0 at the moment (although this can be fixed if needed).
|
8
|
+
|
9
|
+
Also comes with prebuilt binaries (hosted on Github releases), thanks to Stuart Miller (https://github.com/spmiller).
|
10
|
+
|
11
|
+
## Node.js 14.18.x and higher
|
12
|
+
https://github.com/nodejs/node/pull/33010 landed in Node.js 14.18.0, which makes this module no longer needed for heapdumps on out of memory.
|
13
|
+
One can use the `--heapsnapshot-near-heap-limit` Node.js CLI option as an native alternative.
|
14
|
+
See https://nodejs.org/dist/latest-v14.x/docs/api/cli.html#cli_heapsnapshot_near_heap_limit_max_count.
|
15
|
+
|
16
|
+
For Node versions older than 14, use the `2.2.0` release, where this functionality is still present (not maintained anymore).
|
17
|
+
For Node versions 14 and up, use `--heapsnapshot-near-heap-limit` for out-of-memory heapdumps. This functionality has been removed from `3.0.0`.
|
18
|
+
|
19
|
+
One can still use the API of this module to create CPU profiles and heapdumps on request
|
20
|
+
|
21
|
+
# Why?
|
22
|
+
There are several modules around which can create heapdumps (v8-profiler, node-heapdump), although this module creates the heap snapshot from a separate process which performs better and doesn't affect the main event loop.
|
23
|
+
|
24
|
+
# What?
|
25
|
+
When creating a heapdump of CPU profile on request, the DevTools protocol is used to create these files (no native add-on needed).
|
26
|
+
The --inspect node.js flag is needed to make this work (which is validated on startup).
|
27
|
+
|
28
|
+
# Usage
|
29
|
+
|
30
|
+
```javascript
|
31
|
+
npm install node-oom-heapdump
|
32
|
+
```
|
33
|
+
|
34
|
+
Just add the following snippet to your node process.
|
35
|
+
|
36
|
+
```javascript
|
37
|
+
let path = require('path');
|
38
|
+
require('node-oom-heapdump')({
|
39
|
+
path: path.resolve(__dirname, 'my_heapdump')
|
40
|
+
});
|
41
|
+
```
|
42
|
+
|
43
|
+
To make heapdumps and CPU profiles on request, your node process should at least be started with the "--inspect" (or --inspect=port) flag. When the module is loaded, the configured port is verified. If it doesn't respond correctly, a console warning will be shown.
|
44
|
+
|
45
|
+
When running in a low memory environment, the following flags are advised:
|
46
|
+
|
47
|
+
* --max_old_space_size=60 - this will limit your heapsize on 60MB
|
48
|
+
* --optimize_for_size - keep memory as low as possible (GC more often than usual)
|
49
|
+
* --always_compact - keep memory as low as possible (do compactions each GC)
|
50
|
+
|
51
|
+
These might impact performance though.
|
52
|
+
On Node.js 12.x the latter two flags seem to cause some stability issues (see https://github.com/nodejs/node/issues/27552#issuecomment-542695931). So, if you encounter issues on Node.js 12.x in combination with those flags, please refrain from using these.
|
53
|
+
|
54
|
+
# Options
|
55
|
+
* addTimestamp - add a timestamp to the heapdump filename, to make it unique. Default is false.
|
56
|
+
* port - optionally, the alternative DevTools protocol port. Defaults to 9229. Should map on the port given to the --inspect arg.
|
57
|
+
|
58
|
+
# API
|
59
|
+
The API for creating heapdumps and CPU profiles on request. See below for the currently available API.
|
60
|
+
|
61
|
+
Notice that you cannot create a heapdump while a CPU profile is being generated and vice versa; an Error will be thrown if this is the case.
|
62
|
+
|
63
|
+
```javascript
|
64
|
+
let nodeOomHeapdump = require("node-oom-heapdump")({
|
65
|
+
heapdumpOnOOM: false
|
66
|
+
});
|
67
|
+
|
68
|
+
/**
|
69
|
+
* Returns the path to the created heap snapshot in a promise, or rejects on error
|
70
|
+
* @param {String} snapshotPath - path of the snapshot
|
71
|
+
* @return {Promise} Promise containing the heap snapshot path on success or error on rejection
|
72
|
+
*/
|
73
|
+
nodeOomHeapdump.createHeapSnapshot("myheapsnapshotpath").then((snapshotPath) => {
|
74
|
+
// do something with heap snapshot
|
75
|
+
|
76
|
+
// and delete again from disk
|
77
|
+
nodeOomHeapdump.deleteHeapSnapshot(snapshotPath);
|
78
|
+
}).catch((err) => {
|
79
|
+
// handle error
|
80
|
+
});
|
81
|
+
|
82
|
+
/**
|
83
|
+
* Deletes all previously created heapsnapshots from disk
|
84
|
+
*/
|
85
|
+
nodeOomHeapdump.deleteAllHeapSnapshots();
|
86
|
+
|
87
|
+
/**
|
88
|
+
* Deletes a particular snapshot from disk
|
89
|
+
* @param {String} snapshotPath - path of the heap snapshot to delete
|
90
|
+
* @return {Promise}
|
91
|
+
*/
|
92
|
+
nodeOomHeapdump.deleteHeapSnapshot(snapshotPath);
|
93
|
+
|
94
|
+
/**
|
95
|
+
* Returns the path to the created CPU profile in a promise, or rejects on error
|
96
|
+
* @param {String} cpuProfilePath - path of the CPU profile
|
97
|
+
* @param {number} duration - the duration of the CPU profile in ms (default: 30000ms)
|
98
|
+
* @return {Promise} the CPU profile path on success or error on rejection
|
99
|
+
*/
|
100
|
+
nodeOomHeapdump.createCpuProfile("mycpuprofilepath", 10000).then((cpuProfilePath) => {
|
101
|
+
// do something with CPU profile
|
102
|
+
|
103
|
+
// and delete again from disk
|
104
|
+
nodeOomHeapdump.deleteCpuProfile(cpuProfilePath);
|
105
|
+
}).catch((err) => {
|
106
|
+
// handle error
|
107
|
+
});
|
108
|
+
|
109
|
+
/**
|
110
|
+
* Deletes all previously created CPU profiles from disk
|
111
|
+
*/
|
112
|
+
nodeOomHeapdump.deleteAllCpuProfiles();
|
113
|
+
|
114
|
+
/**
|
115
|
+
* Deletes a particular CPU profile from disk
|
116
|
+
* @param {String} cpuProfilePath - path to the CPU profile to delete from disk
|
117
|
+
* @return {Promise}
|
118
|
+
*/
|
119
|
+
nodeOomHeapdump.deleteCpuProfile(cpuProfilePath);
|
120
|
+
```
|
121
|
+
|
122
|
+
# Known issues and limitations
|
123
|
+
|
124
|
+
## Memory usage
|
125
|
+
When creating a heapdump on request, it's notorious for using a lot of memory. This is caused by a bug in V8/DevTools protocol and is reported here (https://bugs.chromium.org/p/chromium/issues/detail?id=768355); the protocol has no backpressure mechanism, which causes the heapdump to be pushed faster than the DevTools client can handle, causing in-memory buffering.
|
126
|
+
|
127
|
+
This is not a problem if your server/machine has memory to spare, but can cause issues in memory restricted environments like a Docker container. Once the process exceeds the container memory threshold, it will be killed by OoMKiller (if enabled). This leads to an empty heapsnapshot file (0 bytes).
|
128
|
+
|
129
|
+
Please vote for that issue to be fixed!
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Microsoft Visual Studio Solution File, Format Version 12.00
|
2
|
+
# Visual Studio 2015
|
3
|
+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "node_oom_heapdump_native", "node_oom_heapdump_native.vcxproj", "{B44BD8E7-8AB3-68F6-9D96-154D16CEC9C0}"
|
4
|
+
EndProject
|
5
|
+
Global
|
6
|
+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
7
|
+
Debug|x64 = Debug|x64
|
8
|
+
Release|x64 = Release|x64
|
9
|
+
EndGlobalSection
|
10
|
+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
11
|
+
{B44BD8E7-8AB3-68F6-9D96-154D16CEC9C0}.Debug|x64.ActiveCfg = Debug|x64
|
12
|
+
{B44BD8E7-8AB3-68F6-9D96-154D16CEC9C0}.Debug|x64.Build.0 = Debug|x64
|
13
|
+
{B44BD8E7-8AB3-68F6-9D96-154D16CEC9C0}.Release|x64.ActiveCfg = Release|x64
|
14
|
+
{B44BD8E7-8AB3-68F6-9D96-154D16CEC9C0}.Release|x64.Build.0 = Release|x64
|
15
|
+
EndGlobalSection
|
16
|
+
GlobalSection(SolutionProperties) = preSolution
|
17
|
+
HideSolutionNode = FALSE
|
18
|
+
EndGlobalSection
|
19
|
+
EndGlobal
|