Diagnostic report | Node.js v26.8.2 Documentation
https://nodejs.org/api/report.html • 190 KB fetched
Open original page
Diagnostic report | Node.js v26.8.2 Documentation Skip to content
Node.js
* About this documentation
* Usage and example
* Assertion testing
* Asynchronous context tracking
* Async hooks
* Buffer
* C++ addons
* C/C++ addons with Node-API
* C++ embedder API
* Child processes
* Cluster
* Command-line options
* Console
* Crypto
* Debugger
* Deprecated APIs
* Diagnostics Channel
* DNS
* Domain
* Environment Variables
* Errors
* Events
* File system
* FFI
* Globals
* HTTP
* HTTP/2
* HTTPS
* Inspector
* Internationalization
* Iterable Streams API
* Modules: CommonJS modules
* Modules: ECMAScript modules
* Modules: node:module API
* Modules: Packages
* Modules: TypeScript
* Net
* OS
* Path
* Performance hooks
* Permissions
* Process
* Punycode
* Query strings
* Readline
* REPL
* Report
* Single executable applications
* SQLite
* Stream
* String decoder
* Test runner
* Timers
* TLS/SSL
* Trace events
* TTY
* UDP/datagram
* URL
* Utilities
* V8
* Virtual File System
* VM
* WASI
* Web Crypto API
* Web Streams API
* Worker threads
* Zlib
*
Code repository and issue tracker
Node.js v26.8.2 documentation
* Node.js v26.8.2
* Table of contents
* Diagnostic report
* Usage
* Report Version
* Version history
* Version 5
* Version 4
* Version 3
* Version 2
* Version 1
* Configuration
* Interaction with workers
* Index
* Index
* About this documentation
* Usage and example
* Assertion testing
* Asynchronous context tracking
* Async hooks
* Buffer
* C++ addons
* C/C++ addons with Node-API
* C++ embedder API
* Child processes
* Cluster
* Command-line options
* Console
* Crypto
* Debugger
* Deprecated APIs
* Diagnostics Channel
* DNS
* Domain
* Environment Variables
* Errors
* Events
* File system
* FFI
* Globals
* HTTP
* HTTP/2
* HTTPS
* Inspector
* Internationalization
* Iterable Streams API
* Modules: CommonJS modules
* Modules: ECMAScript modules
* Modules: node:module API
* Modules: Packages
* Modules: TypeScript
* Net
* OS
* Path
* Performance hooks
* Permissions
* Process
* Punycode
* Query strings
* Readline
* REPL
* Report
* Single executable applications
* SQLite
* Stream
* String decoder
* Test runner
* Timers
* TLS/SSL
* Trace events
* TTY
* UDP/datagram
* URL
* Utilities
* V8
* Virtual File System
* VM
* WASI
* Web Crypto API
* Web Streams API
* Worker threads
* Zlib
* Other versions
* 26.x
* 25.x
* 24.x LTS
* 23.x
* 22.x LTS
* 21.x
* 20.x
* 19.x
* 18.x
* 17.x
* 16.x
* 15.x
* 14.x
* 13.x
* 12.x
* 11.x
*
Options
*
View on single page
*
View as JSON
* Edit on GitHub
Table of contents
* Diagnostic report
* Usage
* Report Version
* Version history
* Version 5
* Version 4
* Version 3
* Version 2
* Version 1
* Configuration
* Interaction with workers
Diagnostic report #
History Version Changes v23.3.0, v22.13.0 Added --report-exclude-env option for excluding environment variables from report generation. v22.0.0, v20.13.0 Added --report-exclude-network option for excluding networking operations that can slow down report generation in some cases.
Stability: 2 - Stable
Delivers a JSON-formatted diagnostic summary, written to a file. The report is intended for development, test, and production use, to capture
and preserve information for problem determination. It includes JavaScript
and native stack traces, heap statistics, platform information, resource
usage etc. With the report option enabled, diagnostic reports can be triggered
on unhandled exceptions, fatal errors and user signals, in addition to
triggering programmatically through API calls. A complete example report that was generated on an uncaught exception
is provided below for reference. {
" header " : {
" reportVersion " : 5 ,
" event " : "exception" ,
" trigger " : "Exception" ,
" filename " : "report.20181221.005011.8974.0.001.json" ,
" dumpEventTime " : "2018-12-21T00:50:11Z" ,
" dumpEventTimeStamp " : "1545371411331" ,
" processId " : 8974 ,
" cwd " : "/home/nodeuser/project/node" ,
" commandLine " : [
"/home/nodeuser/project/node/out/Release/node" ,
"--report-uncaught-exception" ,
"/home/nodeuser/project/node/test/report/test-exception.js" ,
"child"
],
" nodejsVersion " : "v12.0.0-pre" ,
" glibcVersionRuntime " : "2.17" ,
" glibcVersionCompiler " : "2.17" ,
" wordSize " : "64 bit" ,
" arch " : "x64" ,
" platform " : "linux" ,
" componentVersions " : {
" node " : "12.0.0-pre" ,
" v8 " : "7.1.302.28-node.5" ,
" uv " : "1.24.1" ,
" zlib " : "1.2.11" ,
" ares " : "1.15.0" ,
" modules " : "68" ,
" nghttp2 " : "1.34.0" ,
" napi " : "3" ,
" llhttp " : "1.0.1" ,
" openssl " : "1.1.0j"
},
" release " : {
" name " : "node"
},
" osName " : "Linux" ,
" osRelease " : "3.10.0-862.el7.x86_64" ,
" osVersion " : "#1 SMP Wed Mar 21 18:14:51 EDT 2018" ,
" osMachine " : "x86_64" ,
" cpus " : [
{
" model " : "Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz" ,
" speed " : 2700 ,
" user " : 88902660 ,
" nice " : 0 ,
" sys " : 50902570 ,
" idle " : 241732220 ,
" irq " : 0
},
{
" model " : "Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz" ,
" speed " : 2700 ,
" user " : 88902660 ,
" nice " : 0 ,
" sys " : 50902570 ,
" idle " : 241732220 ,
" irq " : 0
}
],
" networkInterfaces " : [
{
" name " : "en0" ,
" internal " : false ,
" mac " : "13:10:de:ad:be:ef" ,
" address " : "10.0.0.37" ,
" netmask " : "255.255.255.0" ,
" family " : "IPv4"
}
],
" host " : "test_machine"
},
" javascriptStack " : {
" message " : "Error: *** test-exception.js: throwing uncaught Error" ,
" stack " : [
"at myException (/home/nodeuser/project/node/test/report/test-exception.js:9:11)" ,
"at Object.<anonymous> (/home/nodeuser/project/node/test/report/test-exception.js:12:3)" ,
"at Module._compile (internal/modules/cjs/loader.js:718:30)" ,
"at Object.Module._extensions..js (internal/modules/cjs/loader.js:729:10)" ,
"at Module.load (internal/modules/cjs/loader.js:617:32)" ,
"at tryModuleLoad (internal/modules/cjs/loader.js:560:12)" ,
"at Function.Module._load (internal/modules/cjs/loader.js:552:3)" ,
"at Function.Module.runMain (internal/modules/cjs/loader.js:771:12)" ,
"at executeUserCode (internal/bootstrap/node.js:332:15)"
]
},
" nativeStack " : [
{
" pc " : "0x000055b57f07a9ef" ,
" symbol " : "report::GetNodeReport(v8::Isolate*, node::Environment*, char const*, char const*, v8::Local<v8::String>, std::ostream&) [./node]"
},
{
" pc " : "0x000055b57f07cf03" ,
" symbol " : "report::GetReport(v8::FunctionCallbackInfo<v8::Value> const&) [./node]"
},
{
" pc " : "0x000055b57f1bccfd" ,
" symbol " : " [./node]"
},
{
" pc " : "0x000055b57f1be048" ,
" symbol " : "v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) [./node]"
},
{
" pc " : "0x000055b57feeda0e" ,
" symbol " : " [./node]"
}
],
" javascriptHeap " : {
" totalMemory " : 5660672 ,
" executableMemory " : 524288 ,
" totalCommittedMemory " : 5488640 ,
" availableMemory " : 4341379928 ,
" totalGlobalHandlesMemory " : 8192 ,
" usedGlobalHandlesMemory " : 3136 ,
" usedMemory " : 4816432 ,
" memoryLimit " : 4345298944 ,
" mallocedMemory " : 254128 ,
" externalMemory " : 315644 ,
" peakMallocedMemory " : 98752 ,
" nativeContextCount " : 1 ,
" detachedContextCount " : 0 ,
" doesZapGarbage " : 0 ,
" heapSpaces " : {
" read_only_space " : {
" memorySize " : 524288 ,
" committedMemory " : 39208 ,
" capacity " : 515584 ,
" used " : 30504 ,
" available " : 485080
},
" new_space " : {
" memorySize " : 2097152 ,
" committedMemory " : 2019312 ,
" capacity " : 1031168 ,
" used " : 985496 ,
" available " : 45672
},
" old_space " : {
" memorySize " : 2273280 ,
" committedMemory " : 1769008 ,
" capacity " : 1974640 ,
" used " : 1725488 ,
" available " : 249152
},
" code_space " : {
" memorySize " : 696320 ,
" committedMemory " : 184896 ,
" capacity " : 152128 ,
" used " : 152128 ,
" available " : 0
},
" map_space " : {
" memorySize " : 536576 ,
" committedMemory " : 344928 ,
" capacity " : 327520 ,
" used " : 327520 ,
" available " : 0
},
" large_object_space " : {
" memorySize " : 0 ,
" committedMemory " : 0 ,
" capacity " : 1520590336 ,
" used " : 0 ,
" available " : 1520590336
},
" new_large_object_space " : {
" memorySize " : 0 ,
" committedMemory " : 0 ,
" capacity " : 0 ,
" used " : 0 ,
" available " : 0
}
}
},
" resourceUsage " : {
" rss " : "35766272" ,
" free_memory " : "1598337024" ,
" total_memory " : "17179869184" ,
" available_memory " : "1598337024" ,
" maxRss " : "36624662528" ,
" constrained_memory " : "36624662528" ,
" userCpuSeconds " : 0.040072 ,
" kernelCpuSeconds " : 0.016029 ,
" cpuConsumptionPercent " : 5.6101 ,
" userCpuConsumptionPercent " : 4.0072 ,
" kernelCpuConsumptionPercent " : 1.6029 ,
" pageFaults " : {
" IORequired " : 0 ,
" IONotRequired " : 4610
},
" fsActivity " : {
" reads " : 0 ,
" writes " : 0
}
},
" uvthreadResourceUsage " : {
" userCpuSeconds " : 0.039843 ,
" kernelCpuSeconds " : 0.015937 ,
" cpuConsumptionPercent " : 5.578 ,
" userCpuConsumptionPercent " : 3.9843 ,
" kernelCpuConsumptionPercent " : 1.5937 ,
" fsActivity " : {
" reads " : 0 ,
" writes " : 0
}
},
" libuv " : [
{
" type " : "async" ,
" is_active " : true ,
" is_referenced " : false ,
" address " : "0x0000000102910900" ,
" details " : ""
},
{
" type " : "timer" ,
" is_active " : false ,
" is_referenced " : false ,
" address " : "0x00007fff5fbfeab0" ,
" repeat " : 0 ,
" firesInMsFromNow " : 94403548320796 ,
" expired " : true
},
{
" type " : "check" ,
" is_active " : true ,
" is_referenced " : false ,
" address " : "0x00007fff5fbfeb48"
},
{
" type " : "idle" ,
" is_active " : false ,
" is_referenced " : true ,
" address " : "0x00007fff5fbfebc0"
},
{
" type " : "prepare" ,
" is_active " : false ,
" is_referenced " : false ,
" address " : "0x00007fff5fbfec38"
},
{
" type " : "check" ,
" is_active " : false ,
" is_referenced " : false ,
" address " : "0x00007fff5fbfecb0"
},
{
" type " : "async" ,
" is_active " : true ,
" is_referenced " : false ,
" address " : "0x000000010188f2e0"
},
{
" type " : "tty" ,
" is_active " : false ,
" is_referenced " : true ,
" address " : "0x000055b581db0e18" ,
" width " : 204 ,
" height " : 55 ,
" fd " : 17 ,
" writeQueueSize " : 0 ,
" readable " : true ,
" writable " : true
},
{
" type " : "signal" ,
" is_active " : true ,
" is_referenced " : false ,
" address " : "0x000055b581d80010" ,
" signum " : 28 ,
" signal " : "SIGWINCH"
},
{
" type " : "tty" ,
" is_active " : true ,
" is_referenced " : true ,
" address " : "0x000055b581df59f8" ,
" width " : 204 ,
" height " : 55 ,
" fd " : 19 ,
" writeQueueSize " : 0 ,
" readable " : true ,
" writable " : true
},
{
" type " : "loop" ,
" is_active " : true ,
" address " : "0x000055fc7b2cb180" ,
" loopIdleTimeSeconds " : 22644.8
},
{
" type " : "tcp" ,
" is_active " : true ,
" is_referenced " : true ,
" address " : "0x000055e70fcb85d8" ,
" localEndpoint " : {
" host " : "localhost" ,
" ip4 " : "127.0.0.1" ,
" port " : 48986
},
" remoteEndpoint " : {
" host " : "localhost" ,
" ip4 " : "127.0.0.1" ,
" port " : 38573
},
" sendBufferSize " : 2626560 ,
" recvBufferSize " : 131072 ,
" fd " : 24 ,
" writeQueueSize " : 0 ,
" readable " : true ,
" writable " : true
}
],
" workers " : [],
" environmentVariables " : {
" REMOTEHOST " : "REMOVED" ,
" MANPATH " : "/opt/rh/devtoolset-3/root/usr/share/man:" ,
" XDG_SESSION_ID " : "66126" ,
" HOSTNAME " : "test_machine" ,
" HOST " : "test_machine" ,
" TERM " : "xterm-256color" ,
" SHELL " : "/bin/csh" ,
" SSH_CLIENT " : "REMOVED" ,
" PERL5LIB " : "/opt/rh/devtoolset-3/root//usr/lib64/perl5/vendor_perl:/opt/rh/devtoolset-3/root/usr/lib/perl5:/opt/rh/devtoolset-3/root//usr/share/perl5/vendor_perl" ,
" OLDPWD " : "/home/nodeuser/project/node/src" ,
" JAVACONFDIRS " : "/opt/rh/devtoolset-3/root/etc/java:/etc/java" ,
" SSH_TTY " : "/dev/pts/0" ,
" PCP_DIR " : "/opt/rh/devtoolset-3/root" ,
" GROUP " : "normaluser" ,
" USER " : "nodeuser" ,
" LD_LIBRARY_PATH " : "/opt/rh/devtoolset-3/root/usr/lib64:/opt/rh/devtoolset-3/root/usr/lib" ,
" HOSTTYPE " : "x86_64-linux" ,
" XDG_CONFIG_DIRS " : "/opt/rh/devtoolset-3/root/etc/xdg:/etc/xdg" ,
" MAIL " : "/var/spool/mail/nodeuser" ,
" PATH " : "/home/nodeuser/project/node:/opt/rh/devtoolset-3/root/usr/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin" ,
" PWD " : "/home/nodeuser/project/node" ,
" LANG " : "en_US.UTF-8" ,
" PS1 " : " \\ u@ \\ h : \\ [ \\ e[31m \\ ] \\ w \\ [ \\ e[m \\ ] > " ,
" SHLVL " : "2" ,
" HOME " : "/home/nodeuser" ,
" OSTYPE " : "linux" ,
" VENDOR " : "unknown" ,
" PYTHONPATH " : "/opt/rh/devtoolset-3/root/usr/lib64/python2.7/site-packages:/opt/rh/devtoolset-3/root/usr/lib/python2.7/site-packages" ,
" MACHTYPE " : "x86_64" ,
" LOGNAME " : "nodeuser" ,
" XDG_DATA_DIRS " : "/opt/rh/devtoolset-3/root/usr/share:/usr/local/share:/usr/share" ,
" LESSOPEN " : "||/usr/bin/lesspipe.sh %s" ,
" INFOPATH " : "/opt/rh/devtoolset-3/root/usr/share/info" ,
" XDG_RUNTIME_DIR " : "/run/user/50141" ,
" _ " : "./node"
},
" userLimits " : {
" core_file_size_blocks " : {
" soft " : "" ,
" hard " : "unlimited"
},
" data_seg_size_bytes " : {
" soft " : "unlimited" ,
" hard " : "unlimited"
},
" file_size_blocks " : {
" soft " : "unlimited" ,
" hard " : "unlimited"
},
" max_locked_memory_bytes " : {
" soft " : "unlimited" ,
" hard " : 65536
},
" max_memory_size_bytes " : {
" soft " : "unlimited" ,
" hard " : "unlimited"
},
" open_files " : {
" soft " : "unlimited" ,
" hard " : 4096
},
" stack_size_bytes " : {
" soft " : "unlimited" ,
" hard " : "unlimited"
},
" cpu_time_seconds " : {
" soft " : "unlimited" ,
" hard " : "unlimited"
},
" max_user_processes " : {
" soft " : "unlimited" ,
" hard " : 4127290
},
" virtual_memory_bytes " : {
" soft " : "unlimited" ,
" hard " : "unlimited"
}
},
" sharedObjects " : [
"/lib64/libdl.so.2" ,
"/lib64/librt.so.1" ,
"/lib64/libstdc++.so.6" ,
"/lib64/libm.so.6" ,
"/lib64/libgcc_s.so.1" ,
"/lib64/libpthread.so.0" ,
"/lib64/libc.so.6" ,
"/lib64/ld-linux-x86-64.so.2"
]
}
json copy
Usage #
node --report-uncaught-exception --report-on-signal \
--report-on-fatalerror app.js
bash copy
*
--report-uncaught-exception Enables report to be generated on
un-caught exceptions. Useful when inspecting JavaScript stack in conjunction
with native stack and other runtime environment data.
*
--report-on-signal Enables report to be generated upon receiving
the specified (or predefined) signal to the running Node.js process. (See
below on how to modify the signal that triggers the report.) Default signal is
SIGUSR2 . Useful when a report needs to be triggered from another program.
Application monitors may leverage this feature to collect report at regular
intervals and plot rich set of internal runtime data to their views.
Signal based report generation is not supported in Windows. Under normal circumstances, there is no need to modify the report triggering
signal. However, if SIGUSR2 is already used for other purposes, then this
flag helps to change the signal for report generation and preserve the original
meaning of SIGUSR2 for the said purposes.
*
--report-on-fatalerror Enables the report to be triggered on fatal errors
(internal errors within the Node.js runtime, such as out of memory)
that leads to termination of the application. Useful to inspect various
diagnostic data elements such as heap, stack, event loop state, resource
consumption etc. to reason about the fatal error.
*
--report-compact Write reports in a compact format, single-line JSON, more
easily consumable by log processing systems than the default multi-line format
designed for human consumption.
*
--report-directory Location at which the report will be
generated.
*
--report-filename Name of the file to which the report will be
written.
*
--report-signal Sets or resets the signal for report generation
(not supported on Windows). Default signal is SIGUSR2 .
*
--report-exclude-network Exclude header.networkInterfaces and disable the reverse DNS queries
in libuv.*.(remote|local)Endpoint.host from the diagnostic report.
By default this is not set and the network interfaces are included.
*
--report-exclude-env Exclude environmentVariables from the
diagnostic report. By default this is not set and the environment
variables are included.
A report can also be triggered via an API call from a JavaScript application: process . report . writeReport () ;
js copy
This function takes an optional additional argument filename , which is
the name of a file into which the report is written. process . report . writeReport ( './foo.json' ) ;
js copy
This function takes an optional additional argument err which is an Error
object that will be used as the context for the JavaScript stack printed in the
report. When using report to handle errors in a callback or an exception
handler, this allows the report to include the location of the original error as
well as where it was handled. try {
process . chdir ( '/non-existent-path' ) ;
} catch (err) {
process . report . writeReport (err) ;
}
// Any other code
js copy
If both filename and error object are passed to writeReport() the
error object must be the second parameter. try {
process . chdir ( '/non-existent-path' ) ;
} catch (err) {
process . report . writeReport (filename , err) ;
}
// Any other code
js copy
The content of the diagnostic report can be returned as a JavaScript Object
via an API call from a JavaScript application: const report = process . report . getReport () ;
console . log ( typeof report === 'object' ) ; // true
// Similar to process.report.writeReport() output
console . log ( JSON . stringify (report , null , 2 )) ;
js copy
This function takes an optional additional argument err , which is an Error
object that will be used as the context for the JavaScript stack printed in the
report. const report = process . report . getReport ( new Error ( 'custom error' )) ;
console . log ( typeof report === 'object' ) ; // true
js copy
The API versions are useful when inspecting the runtime state from within
the application, in expectation of self-adjusting the
Links found on this page
- Skip to content [direct]
- Node.js [direct]
- About this documentation [direct]
- Usage and example [direct]
- Assertion testing [direct]
- Asynchronous context tracking [direct]
- Async hooks [direct]
- Buffer [direct]
- C++ addons [direct]
- C/C++ addons with Node-API [direct]
- C++ embedder API [direct]
- Child processes [direct]
- Cluster [direct]
- Command-line options [direct]
- Console [direct]
- Crypto [direct]
- Debugger [direct]
- Deprecated APIs [direct]
- Diagnostics Channel [direct]
- DNS [direct]
- Domain [direct]
- Environment Variables [direct]
- Errors [direct]
- Events [direct]
- File system [direct]
- FFI [direct]
- Globals [direct]
- HTTP [direct]
- HTTP/2 [direct]
- HTTPS [direct]
- Inspector [direct]
- Internationalization [direct]
- Iterable Streams API [direct]
- Modules: CommonJS modules [direct]
- Modules: ECMAScript modules [direct]
- Modules: node:module API [direct]
- Modules: Packages [direct]
- Modules: TypeScript [direct]
- Net [direct]
- OS [direct]
- Path [direct]
- Performance hooks [direct]
- Permissions [direct]
- Process [direct]
- Punycode [direct]
- Query strings [direct]
- Readline [direct]
- REPL [direct]
- Single executable applications [direct]
- SQLite [direct]
- Stream [direct]
- String decoder [direct]
- Test runner [direct]
- Timers [direct]
- TLS/SSL [direct]
- Trace events [direct]
- TTY [direct]
- UDP/datagram [direct]
- URL [direct]
- Utilities [direct]
- V8 [direct]
- Virtual File System [direct]
- VM [direct]
- WASI [direct]
- Web Crypto API [direct]
- Web Streams API [direct]
- Worker threads [direct]
- Zlib [direct]
- Code repository and issue tracker [direct]
- Index [direct]
- 26.x [direct]
- 25.x [direct]
- 24.x LTS [direct]
- 23.x [direct]
- 22.x LTS [direct]
- 21.x [direct]
- 20.x [direct]
- 19.x [direct]
- 18.x [direct]
- 17.x [direct]