11cb0ef41Sopenharmony_ci# Diagnostic report 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ci<!--introduced_in=v11.8.0--> 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ci<!-- type=misc --> 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ci> Stability: 2 - Stable 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ci<!-- name=report --> 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ciDelivers a JSON-formatted diagnostic summary, written to a file. 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ciThe report is intended for development, test, and production use, to capture 141cb0ef41Sopenharmony_ciand preserve information for problem determination. It includes JavaScript 151cb0ef41Sopenharmony_ciand native stack traces, heap statistics, platform information, resource 161cb0ef41Sopenharmony_ciusage etc. With the report option enabled, diagnostic reports can be triggered 171cb0ef41Sopenharmony_cion unhandled exceptions, fatal errors and user signals, in addition to 181cb0ef41Sopenharmony_citriggering programmatically through API calls. 191cb0ef41Sopenharmony_ci 201cb0ef41Sopenharmony_ciA complete example report that was generated on an uncaught exception 211cb0ef41Sopenharmony_ciis provided below for reference. 221cb0ef41Sopenharmony_ci 231cb0ef41Sopenharmony_ci```json 241cb0ef41Sopenharmony_ci{ 251cb0ef41Sopenharmony_ci "header": { 261cb0ef41Sopenharmony_ci "reportVersion": 3, 271cb0ef41Sopenharmony_ci "event": "exception", 281cb0ef41Sopenharmony_ci "trigger": "Exception", 291cb0ef41Sopenharmony_ci "filename": "report.20181221.005011.8974.0.001.json", 301cb0ef41Sopenharmony_ci "dumpEventTime": "2018-12-21T00:50:11Z", 311cb0ef41Sopenharmony_ci "dumpEventTimeStamp": "1545371411331", 321cb0ef41Sopenharmony_ci "processId": 8974, 331cb0ef41Sopenharmony_ci "cwd": "/home/nodeuser/project/node", 341cb0ef41Sopenharmony_ci "commandLine": [ 351cb0ef41Sopenharmony_ci "/home/nodeuser/project/node/out/Release/node", 361cb0ef41Sopenharmony_ci "--report-uncaught-exception", 371cb0ef41Sopenharmony_ci "/home/nodeuser/project/node/test/report/test-exception.js", 381cb0ef41Sopenharmony_ci "child" 391cb0ef41Sopenharmony_ci ], 401cb0ef41Sopenharmony_ci "nodejsVersion": "v12.0.0-pre", 411cb0ef41Sopenharmony_ci "glibcVersionRuntime": "2.17", 421cb0ef41Sopenharmony_ci "glibcVersionCompiler": "2.17", 431cb0ef41Sopenharmony_ci "wordSize": "64 bit", 441cb0ef41Sopenharmony_ci "arch": "x64", 451cb0ef41Sopenharmony_ci "platform": "linux", 461cb0ef41Sopenharmony_ci "componentVersions": { 471cb0ef41Sopenharmony_ci "node": "12.0.0-pre", 481cb0ef41Sopenharmony_ci "v8": "7.1.302.28-node.5", 491cb0ef41Sopenharmony_ci "uv": "1.24.1", 501cb0ef41Sopenharmony_ci "zlib": "1.2.11", 511cb0ef41Sopenharmony_ci "ares": "1.15.0", 521cb0ef41Sopenharmony_ci "modules": "68", 531cb0ef41Sopenharmony_ci "nghttp2": "1.34.0", 541cb0ef41Sopenharmony_ci "napi": "3", 551cb0ef41Sopenharmony_ci "llhttp": "1.0.1", 561cb0ef41Sopenharmony_ci "openssl": "1.1.0j" 571cb0ef41Sopenharmony_ci }, 581cb0ef41Sopenharmony_ci "release": { 591cb0ef41Sopenharmony_ci "name": "node" 601cb0ef41Sopenharmony_ci }, 611cb0ef41Sopenharmony_ci "osName": "Linux", 621cb0ef41Sopenharmony_ci "osRelease": "3.10.0-862.el7.x86_64", 631cb0ef41Sopenharmony_ci "osVersion": "#1 SMP Wed Mar 21 18:14:51 EDT 2018", 641cb0ef41Sopenharmony_ci "osMachine": "x86_64", 651cb0ef41Sopenharmony_ci "cpus": [ 661cb0ef41Sopenharmony_ci { 671cb0ef41Sopenharmony_ci "model": "Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz", 681cb0ef41Sopenharmony_ci "speed": 2700, 691cb0ef41Sopenharmony_ci "user": 88902660, 701cb0ef41Sopenharmony_ci "nice": 0, 711cb0ef41Sopenharmony_ci "sys": 50902570, 721cb0ef41Sopenharmony_ci "idle": 241732220, 731cb0ef41Sopenharmony_ci "irq": 0 741cb0ef41Sopenharmony_ci }, 751cb0ef41Sopenharmony_ci { 761cb0ef41Sopenharmony_ci "model": "Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz", 771cb0ef41Sopenharmony_ci "speed": 2700, 781cb0ef41Sopenharmony_ci "user": 88902660, 791cb0ef41Sopenharmony_ci "nice": 0, 801cb0ef41Sopenharmony_ci "sys": 50902570, 811cb0ef41Sopenharmony_ci "idle": 241732220, 821cb0ef41Sopenharmony_ci "irq": 0 831cb0ef41Sopenharmony_ci } 841cb0ef41Sopenharmony_ci ], 851cb0ef41Sopenharmony_ci "networkInterfaces": [ 861cb0ef41Sopenharmony_ci { 871cb0ef41Sopenharmony_ci "name": "en0", 881cb0ef41Sopenharmony_ci "internal": false, 891cb0ef41Sopenharmony_ci "mac": "13:10:de:ad:be:ef", 901cb0ef41Sopenharmony_ci "address": "10.0.0.37", 911cb0ef41Sopenharmony_ci "netmask": "255.255.255.0", 921cb0ef41Sopenharmony_ci "family": "IPv4" 931cb0ef41Sopenharmony_ci } 941cb0ef41Sopenharmony_ci ], 951cb0ef41Sopenharmony_ci "host": "test_machine" 961cb0ef41Sopenharmony_ci }, 971cb0ef41Sopenharmony_ci "javascriptStack": { 981cb0ef41Sopenharmony_ci "message": "Error: *** test-exception.js: throwing uncaught Error", 991cb0ef41Sopenharmony_ci "stack": [ 1001cb0ef41Sopenharmony_ci "at myException (/home/nodeuser/project/node/test/report/test-exception.js:9:11)", 1011cb0ef41Sopenharmony_ci "at Object.<anonymous> (/home/nodeuser/project/node/test/report/test-exception.js:12:3)", 1021cb0ef41Sopenharmony_ci "at Module._compile (internal/modules/cjs/loader.js:718:30)", 1031cb0ef41Sopenharmony_ci "at Object.Module._extensions..js (internal/modules/cjs/loader.js:729:10)", 1041cb0ef41Sopenharmony_ci "at Module.load (internal/modules/cjs/loader.js:617:32)", 1051cb0ef41Sopenharmony_ci "at tryModuleLoad (internal/modules/cjs/loader.js:560:12)", 1061cb0ef41Sopenharmony_ci "at Function.Module._load (internal/modules/cjs/loader.js:552:3)", 1071cb0ef41Sopenharmony_ci "at Function.Module.runMain (internal/modules/cjs/loader.js:771:12)", 1081cb0ef41Sopenharmony_ci "at executeUserCode (internal/bootstrap/node.js:332:15)" 1091cb0ef41Sopenharmony_ci ] 1101cb0ef41Sopenharmony_ci }, 1111cb0ef41Sopenharmony_ci "nativeStack": [ 1121cb0ef41Sopenharmony_ci { 1131cb0ef41Sopenharmony_ci "pc": "0x000055b57f07a9ef", 1141cb0ef41Sopenharmony_ci "symbol": "report::GetNodeReport(v8::Isolate*, node::Environment*, char const*, char const*, v8::Local<v8::String>, std::ostream&) [./node]" 1151cb0ef41Sopenharmony_ci }, 1161cb0ef41Sopenharmony_ci { 1171cb0ef41Sopenharmony_ci "pc": "0x000055b57f07cf03", 1181cb0ef41Sopenharmony_ci "symbol": "report::GetReport(v8::FunctionCallbackInfo<v8::Value> const&) [./node]" 1191cb0ef41Sopenharmony_ci }, 1201cb0ef41Sopenharmony_ci { 1211cb0ef41Sopenharmony_ci "pc": "0x000055b57f1bccfd", 1221cb0ef41Sopenharmony_ci "symbol": " [./node]" 1231cb0ef41Sopenharmony_ci }, 1241cb0ef41Sopenharmony_ci { 1251cb0ef41Sopenharmony_ci "pc": "0x000055b57f1be048", 1261cb0ef41Sopenharmony_ci "symbol": "v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) [./node]" 1271cb0ef41Sopenharmony_ci }, 1281cb0ef41Sopenharmony_ci { 1291cb0ef41Sopenharmony_ci "pc": "0x000055b57feeda0e", 1301cb0ef41Sopenharmony_ci "symbol": " [./node]" 1311cb0ef41Sopenharmony_ci } 1321cb0ef41Sopenharmony_ci ], 1331cb0ef41Sopenharmony_ci "javascriptHeap": { 1341cb0ef41Sopenharmony_ci "totalMemory": 5660672, 1351cb0ef41Sopenharmony_ci "executableMemory": 524288, 1361cb0ef41Sopenharmony_ci "totalCommittedMemory": 5488640, 1371cb0ef41Sopenharmony_ci "availableMemory": 4341379928, 1381cb0ef41Sopenharmony_ci "totalGlobalHandlesMemory": 8192, 1391cb0ef41Sopenharmony_ci "usedGlobalHandlesMemory": 3136, 1401cb0ef41Sopenharmony_ci "usedMemory": 4816432, 1411cb0ef41Sopenharmony_ci "memoryLimit": 4345298944, 1421cb0ef41Sopenharmony_ci "mallocedMemory": 254128, 1431cb0ef41Sopenharmony_ci "externalMemory": 315644, 1441cb0ef41Sopenharmony_ci "peakMallocedMemory": 98752, 1451cb0ef41Sopenharmony_ci "nativeContextCount": 1, 1461cb0ef41Sopenharmony_ci "detachedContextCount": 0, 1471cb0ef41Sopenharmony_ci "doesZapGarbage": 0, 1481cb0ef41Sopenharmony_ci "heapSpaces": { 1491cb0ef41Sopenharmony_ci "read_only_space": { 1501cb0ef41Sopenharmony_ci "memorySize": 524288, 1511cb0ef41Sopenharmony_ci "committedMemory": 39208, 1521cb0ef41Sopenharmony_ci "capacity": 515584, 1531cb0ef41Sopenharmony_ci "used": 30504, 1541cb0ef41Sopenharmony_ci "available": 485080 1551cb0ef41Sopenharmony_ci }, 1561cb0ef41Sopenharmony_ci "new_space": { 1571cb0ef41Sopenharmony_ci "memorySize": 2097152, 1581cb0ef41Sopenharmony_ci "committedMemory": 2019312, 1591cb0ef41Sopenharmony_ci "capacity": 1031168, 1601cb0ef41Sopenharmony_ci "used": 985496, 1611cb0ef41Sopenharmony_ci "available": 45672 1621cb0ef41Sopenharmony_ci }, 1631cb0ef41Sopenharmony_ci "old_space": { 1641cb0ef41Sopenharmony_ci "memorySize": 2273280, 1651cb0ef41Sopenharmony_ci "committedMemory": 1769008, 1661cb0ef41Sopenharmony_ci "capacity": 1974640, 1671cb0ef41Sopenharmony_ci "used": 1725488, 1681cb0ef41Sopenharmony_ci "available": 249152 1691cb0ef41Sopenharmony_ci }, 1701cb0ef41Sopenharmony_ci "code_space": { 1711cb0ef41Sopenharmony_ci "memorySize": 696320, 1721cb0ef41Sopenharmony_ci "committedMemory": 184896, 1731cb0ef41Sopenharmony_ci "capacity": 152128, 1741cb0ef41Sopenharmony_ci "used": 152128, 1751cb0ef41Sopenharmony_ci "available": 0 1761cb0ef41Sopenharmony_ci }, 1771cb0ef41Sopenharmony_ci "map_space": { 1781cb0ef41Sopenharmony_ci "memorySize": 536576, 1791cb0ef41Sopenharmony_ci "committedMemory": 344928, 1801cb0ef41Sopenharmony_ci "capacity": 327520, 1811cb0ef41Sopenharmony_ci "used": 327520, 1821cb0ef41Sopenharmony_ci "available": 0 1831cb0ef41Sopenharmony_ci }, 1841cb0ef41Sopenharmony_ci "large_object_space": { 1851cb0ef41Sopenharmony_ci "memorySize": 0, 1861cb0ef41Sopenharmony_ci "committedMemory": 0, 1871cb0ef41Sopenharmony_ci "capacity": 1520590336, 1881cb0ef41Sopenharmony_ci "used": 0, 1891cb0ef41Sopenharmony_ci "available": 1520590336 1901cb0ef41Sopenharmony_ci }, 1911cb0ef41Sopenharmony_ci "new_large_object_space": { 1921cb0ef41Sopenharmony_ci "memorySize": 0, 1931cb0ef41Sopenharmony_ci "committedMemory": 0, 1941cb0ef41Sopenharmony_ci "capacity": 0, 1951cb0ef41Sopenharmony_ci "used": 0, 1961cb0ef41Sopenharmony_ci "available": 0 1971cb0ef41Sopenharmony_ci } 1981cb0ef41Sopenharmony_ci } 1991cb0ef41Sopenharmony_ci }, 2001cb0ef41Sopenharmony_ci "resourceUsage": { 2011cb0ef41Sopenharmony_ci "rss": "35766272", 2021cb0ef41Sopenharmony_ci "free_memory": "1598337024", 2031cb0ef41Sopenharmony_ci "total_memory": "17179869184", 2041cb0ef41Sopenharmony_ci "available_memory": "1598337024", 2051cb0ef41Sopenharmony_ci "maxRss": "36624662528", 2061cb0ef41Sopenharmony_ci "constrained_memory": "36624662528", 2071cb0ef41Sopenharmony_ci "userCpuSeconds": 0.040072, 2081cb0ef41Sopenharmony_ci "kernelCpuSeconds": 0.016029, 2091cb0ef41Sopenharmony_ci "cpuConsumptionPercent": 5.6101, 2101cb0ef41Sopenharmony_ci "userCpuConsumptionPercent": 4.0072, 2111cb0ef41Sopenharmony_ci "kernelCpuConsumptionPercent": 1.6029, 2121cb0ef41Sopenharmony_ci "pageFaults": { 2131cb0ef41Sopenharmony_ci "IORequired": 0, 2141cb0ef41Sopenharmony_ci "IONotRequired": 4610 2151cb0ef41Sopenharmony_ci }, 2161cb0ef41Sopenharmony_ci "fsActivity": { 2171cb0ef41Sopenharmony_ci "reads": 0, 2181cb0ef41Sopenharmony_ci "writes": 0 2191cb0ef41Sopenharmony_ci } 2201cb0ef41Sopenharmony_ci }, 2211cb0ef41Sopenharmony_ci "uvthreadResourceUsage": { 2221cb0ef41Sopenharmony_ci "userCpuSeconds": 0.039843, 2231cb0ef41Sopenharmony_ci "kernelCpuSeconds": 0.015937, 2241cb0ef41Sopenharmony_ci "cpuConsumptionPercent": 5.578, 2251cb0ef41Sopenharmony_ci "userCpuConsumptionPercent": 3.9843, 2261cb0ef41Sopenharmony_ci "kernelCpuConsumptionPercent": 1.5937, 2271cb0ef41Sopenharmony_ci "fsActivity": { 2281cb0ef41Sopenharmony_ci "reads": 0, 2291cb0ef41Sopenharmony_ci "writes": 0 2301cb0ef41Sopenharmony_ci } 2311cb0ef41Sopenharmony_ci }, 2321cb0ef41Sopenharmony_ci "libuv": [ 2331cb0ef41Sopenharmony_ci { 2341cb0ef41Sopenharmony_ci "type": "async", 2351cb0ef41Sopenharmony_ci "is_active": true, 2361cb0ef41Sopenharmony_ci "is_referenced": false, 2371cb0ef41Sopenharmony_ci "address": "0x0000000102910900", 2381cb0ef41Sopenharmony_ci "details": "" 2391cb0ef41Sopenharmony_ci }, 2401cb0ef41Sopenharmony_ci { 2411cb0ef41Sopenharmony_ci "type": "timer", 2421cb0ef41Sopenharmony_ci "is_active": false, 2431cb0ef41Sopenharmony_ci "is_referenced": false, 2441cb0ef41Sopenharmony_ci "address": "0x00007fff5fbfeab0", 2451cb0ef41Sopenharmony_ci "repeat": 0, 2461cb0ef41Sopenharmony_ci "firesInMsFromNow": 94403548320796, 2471cb0ef41Sopenharmony_ci "expired": true 2481cb0ef41Sopenharmony_ci }, 2491cb0ef41Sopenharmony_ci { 2501cb0ef41Sopenharmony_ci "type": "check", 2511cb0ef41Sopenharmony_ci "is_active": true, 2521cb0ef41Sopenharmony_ci "is_referenced": false, 2531cb0ef41Sopenharmony_ci "address": "0x00007fff5fbfeb48" 2541cb0ef41Sopenharmony_ci }, 2551cb0ef41Sopenharmony_ci { 2561cb0ef41Sopenharmony_ci "type": "idle", 2571cb0ef41Sopenharmony_ci "is_active": false, 2581cb0ef41Sopenharmony_ci "is_referenced": true, 2591cb0ef41Sopenharmony_ci "address": "0x00007fff5fbfebc0" 2601cb0ef41Sopenharmony_ci }, 2611cb0ef41Sopenharmony_ci { 2621cb0ef41Sopenharmony_ci "type": "prepare", 2631cb0ef41Sopenharmony_ci "is_active": false, 2641cb0ef41Sopenharmony_ci "is_referenced": false, 2651cb0ef41Sopenharmony_ci "address": "0x00007fff5fbfec38" 2661cb0ef41Sopenharmony_ci }, 2671cb0ef41Sopenharmony_ci { 2681cb0ef41Sopenharmony_ci "type": "check", 2691cb0ef41Sopenharmony_ci "is_active": false, 2701cb0ef41Sopenharmony_ci "is_referenced": false, 2711cb0ef41Sopenharmony_ci "address": "0x00007fff5fbfecb0" 2721cb0ef41Sopenharmony_ci }, 2731cb0ef41Sopenharmony_ci { 2741cb0ef41Sopenharmony_ci "type": "async", 2751cb0ef41Sopenharmony_ci "is_active": true, 2761cb0ef41Sopenharmony_ci "is_referenced": false, 2771cb0ef41Sopenharmony_ci "address": "0x000000010188f2e0" 2781cb0ef41Sopenharmony_ci }, 2791cb0ef41Sopenharmony_ci { 2801cb0ef41Sopenharmony_ci "type": "tty", 2811cb0ef41Sopenharmony_ci "is_active": false, 2821cb0ef41Sopenharmony_ci "is_referenced": true, 2831cb0ef41Sopenharmony_ci "address": "0x000055b581db0e18", 2841cb0ef41Sopenharmony_ci "width": 204, 2851cb0ef41Sopenharmony_ci "height": 55, 2861cb0ef41Sopenharmony_ci "fd": 17, 2871cb0ef41Sopenharmony_ci "writeQueueSize": 0, 2881cb0ef41Sopenharmony_ci "readable": true, 2891cb0ef41Sopenharmony_ci "writable": true 2901cb0ef41Sopenharmony_ci }, 2911cb0ef41Sopenharmony_ci { 2921cb0ef41Sopenharmony_ci "type": "signal", 2931cb0ef41Sopenharmony_ci "is_active": true, 2941cb0ef41Sopenharmony_ci "is_referenced": false, 2951cb0ef41Sopenharmony_ci "address": "0x000055b581d80010", 2961cb0ef41Sopenharmony_ci "signum": 28, 2971cb0ef41Sopenharmony_ci "signal": "SIGWINCH" 2981cb0ef41Sopenharmony_ci }, 2991cb0ef41Sopenharmony_ci { 3001cb0ef41Sopenharmony_ci "type": "tty", 3011cb0ef41Sopenharmony_ci "is_active": true, 3021cb0ef41Sopenharmony_ci "is_referenced": true, 3031cb0ef41Sopenharmony_ci "address": "0x000055b581df59f8", 3041cb0ef41Sopenharmony_ci "width": 204, 3051cb0ef41Sopenharmony_ci "height": 55, 3061cb0ef41Sopenharmony_ci "fd": 19, 3071cb0ef41Sopenharmony_ci "writeQueueSize": 0, 3081cb0ef41Sopenharmony_ci "readable": true, 3091cb0ef41Sopenharmony_ci "writable": true 3101cb0ef41Sopenharmony_ci }, 3111cb0ef41Sopenharmony_ci { 3121cb0ef41Sopenharmony_ci "type": "loop", 3131cb0ef41Sopenharmony_ci "is_active": true, 3141cb0ef41Sopenharmony_ci "address": "0x000055fc7b2cb180", 3151cb0ef41Sopenharmony_ci "loopIdleTimeSeconds": 22644.8 3161cb0ef41Sopenharmony_ci } 3171cb0ef41Sopenharmony_ci ], 3181cb0ef41Sopenharmony_ci "workers": [], 3191cb0ef41Sopenharmony_ci "environmentVariables": { 3201cb0ef41Sopenharmony_ci "REMOTEHOST": "REMOVED", 3211cb0ef41Sopenharmony_ci "MANPATH": "/opt/rh/devtoolset-3/root/usr/share/man:", 3221cb0ef41Sopenharmony_ci "XDG_SESSION_ID": "66126", 3231cb0ef41Sopenharmony_ci "HOSTNAME": "test_machine", 3241cb0ef41Sopenharmony_ci "HOST": "test_machine", 3251cb0ef41Sopenharmony_ci "TERM": "xterm-256color", 3261cb0ef41Sopenharmony_ci "SHELL": "/bin/csh", 3271cb0ef41Sopenharmony_ci "SSH_CLIENT": "REMOVED", 3281cb0ef41Sopenharmony_ci "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", 3291cb0ef41Sopenharmony_ci "OLDPWD": "/home/nodeuser/project/node/src", 3301cb0ef41Sopenharmony_ci "JAVACONFDIRS": "/opt/rh/devtoolset-3/root/etc/java:/etc/java", 3311cb0ef41Sopenharmony_ci "SSH_TTY": "/dev/pts/0", 3321cb0ef41Sopenharmony_ci "PCP_DIR": "/opt/rh/devtoolset-3/root", 3331cb0ef41Sopenharmony_ci "GROUP": "normaluser", 3341cb0ef41Sopenharmony_ci "USER": "nodeuser", 3351cb0ef41Sopenharmony_ci "LD_LIBRARY_PATH": "/opt/rh/devtoolset-3/root/usr/lib64:/opt/rh/devtoolset-3/root/usr/lib", 3361cb0ef41Sopenharmony_ci "HOSTTYPE": "x86_64-linux", 3371cb0ef41Sopenharmony_ci "XDG_CONFIG_DIRS": "/opt/rh/devtoolset-3/root/etc/xdg:/etc/xdg", 3381cb0ef41Sopenharmony_ci "MAIL": "/var/spool/mail/nodeuser", 3391cb0ef41Sopenharmony_ci "PATH": "/home/nodeuser/project/node:/opt/rh/devtoolset-3/root/usr/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin", 3401cb0ef41Sopenharmony_ci "PWD": "/home/nodeuser/project/node", 3411cb0ef41Sopenharmony_ci "LANG": "en_US.UTF-8", 3421cb0ef41Sopenharmony_ci "PS1": "\\u@\\h : \\[\\e[31m\\]\\w\\[\\e[m\\] > ", 3431cb0ef41Sopenharmony_ci "SHLVL": "2", 3441cb0ef41Sopenharmony_ci "HOME": "/home/nodeuser", 3451cb0ef41Sopenharmony_ci "OSTYPE": "linux", 3461cb0ef41Sopenharmony_ci "VENDOR": "unknown", 3471cb0ef41Sopenharmony_ci "PYTHONPATH": "/opt/rh/devtoolset-3/root/usr/lib64/python2.7/site-packages:/opt/rh/devtoolset-3/root/usr/lib/python2.7/site-packages", 3481cb0ef41Sopenharmony_ci "MACHTYPE": "x86_64", 3491cb0ef41Sopenharmony_ci "LOGNAME": "nodeuser", 3501cb0ef41Sopenharmony_ci "XDG_DATA_DIRS": "/opt/rh/devtoolset-3/root/usr/share:/usr/local/share:/usr/share", 3511cb0ef41Sopenharmony_ci "LESSOPEN": "||/usr/bin/lesspipe.sh %s", 3521cb0ef41Sopenharmony_ci "INFOPATH": "/opt/rh/devtoolset-3/root/usr/share/info", 3531cb0ef41Sopenharmony_ci "XDG_RUNTIME_DIR": "/run/user/50141", 3541cb0ef41Sopenharmony_ci "_": "./node" 3551cb0ef41Sopenharmony_ci }, 3561cb0ef41Sopenharmony_ci "userLimits": { 3571cb0ef41Sopenharmony_ci "core_file_size_blocks": { 3581cb0ef41Sopenharmony_ci "soft": "", 3591cb0ef41Sopenharmony_ci "hard": "unlimited" 3601cb0ef41Sopenharmony_ci }, 3611cb0ef41Sopenharmony_ci "data_seg_size_kbytes": { 3621cb0ef41Sopenharmony_ci "soft": "unlimited", 3631cb0ef41Sopenharmony_ci "hard": "unlimited" 3641cb0ef41Sopenharmony_ci }, 3651cb0ef41Sopenharmony_ci "file_size_blocks": { 3661cb0ef41Sopenharmony_ci "soft": "unlimited", 3671cb0ef41Sopenharmony_ci "hard": "unlimited" 3681cb0ef41Sopenharmony_ci }, 3691cb0ef41Sopenharmony_ci "max_locked_memory_bytes": { 3701cb0ef41Sopenharmony_ci "soft": "unlimited", 3711cb0ef41Sopenharmony_ci "hard": 65536 3721cb0ef41Sopenharmony_ci }, 3731cb0ef41Sopenharmony_ci "max_memory_size_kbytes": { 3741cb0ef41Sopenharmony_ci "soft": "unlimited", 3751cb0ef41Sopenharmony_ci "hard": "unlimited" 3761cb0ef41Sopenharmony_ci }, 3771cb0ef41Sopenharmony_ci "open_files": { 3781cb0ef41Sopenharmony_ci "soft": "unlimited", 3791cb0ef41Sopenharmony_ci "hard": 4096 3801cb0ef41Sopenharmony_ci }, 3811cb0ef41Sopenharmony_ci "stack_size_bytes": { 3821cb0ef41Sopenharmony_ci "soft": "unlimited", 3831cb0ef41Sopenharmony_ci "hard": "unlimited" 3841cb0ef41Sopenharmony_ci }, 3851cb0ef41Sopenharmony_ci "cpu_time_seconds": { 3861cb0ef41Sopenharmony_ci "soft": "unlimited", 3871cb0ef41Sopenharmony_ci "hard": "unlimited" 3881cb0ef41Sopenharmony_ci }, 3891cb0ef41Sopenharmony_ci "max_user_processes": { 3901cb0ef41Sopenharmony_ci "soft": "unlimited", 3911cb0ef41Sopenharmony_ci "hard": 4127290 3921cb0ef41Sopenharmony_ci }, 3931cb0ef41Sopenharmony_ci "virtual_memory_kbytes": { 3941cb0ef41Sopenharmony_ci "soft": "unlimited", 3951cb0ef41Sopenharmony_ci "hard": "unlimited" 3961cb0ef41Sopenharmony_ci } 3971cb0ef41Sopenharmony_ci }, 3981cb0ef41Sopenharmony_ci "sharedObjects": [ 3991cb0ef41Sopenharmony_ci "/lib64/libdl.so.2", 4001cb0ef41Sopenharmony_ci "/lib64/librt.so.1", 4011cb0ef41Sopenharmony_ci "/lib64/libstdc++.so.6", 4021cb0ef41Sopenharmony_ci "/lib64/libm.so.6", 4031cb0ef41Sopenharmony_ci "/lib64/libgcc_s.so.1", 4041cb0ef41Sopenharmony_ci "/lib64/libpthread.so.0", 4051cb0ef41Sopenharmony_ci "/lib64/libc.so.6", 4061cb0ef41Sopenharmony_ci "/lib64/ld-linux-x86-64.so.2" 4071cb0ef41Sopenharmony_ci ] 4081cb0ef41Sopenharmony_ci} 4091cb0ef41Sopenharmony_ci``` 4101cb0ef41Sopenharmony_ci 4111cb0ef41Sopenharmony_ci## Usage 4121cb0ef41Sopenharmony_ci 4131cb0ef41Sopenharmony_ci```bash 4141cb0ef41Sopenharmony_cinode --report-uncaught-exception --report-on-signal \ 4151cb0ef41Sopenharmony_ci--report-on-fatalerror app.js 4161cb0ef41Sopenharmony_ci``` 4171cb0ef41Sopenharmony_ci 4181cb0ef41Sopenharmony_ci* `--report-uncaught-exception` Enables report to be generated on 4191cb0ef41Sopenharmony_ci un-caught exceptions. Useful when inspecting JavaScript stack in conjunction 4201cb0ef41Sopenharmony_ci with native stack and other runtime environment data. 4211cb0ef41Sopenharmony_ci 4221cb0ef41Sopenharmony_ci* `--report-on-signal` Enables report to be generated upon receiving 4231cb0ef41Sopenharmony_ci the specified (or predefined) signal to the running Node.js process. (See 4241cb0ef41Sopenharmony_ci below on how to modify the signal that triggers the report.) Default signal is 4251cb0ef41Sopenharmony_ci `SIGUSR2`. Useful when a report needs to be triggered from another program. 4261cb0ef41Sopenharmony_ci Application monitors may leverage this feature to collect report at regular 4271cb0ef41Sopenharmony_ci intervals and plot rich set of internal runtime data to their views. 4281cb0ef41Sopenharmony_ci 4291cb0ef41Sopenharmony_ciSignal based report generation is not supported in Windows. 4301cb0ef41Sopenharmony_ci 4311cb0ef41Sopenharmony_ciUnder normal circumstances, there is no need to modify the report triggering 4321cb0ef41Sopenharmony_cisignal. However, if `SIGUSR2` is already used for other purposes, then this 4331cb0ef41Sopenharmony_ciflag helps to change the signal for report generation and preserve the original 4341cb0ef41Sopenharmony_cimeaning of `SIGUSR2` for the said purposes. 4351cb0ef41Sopenharmony_ci 4361cb0ef41Sopenharmony_ci* `--report-on-fatalerror` Enables the report to be triggered on fatal errors 4371cb0ef41Sopenharmony_ci (internal errors within the Node.js runtime, such as out of memory) 4381cb0ef41Sopenharmony_ci that leads to termination of the application. Useful to inspect various 4391cb0ef41Sopenharmony_ci diagnostic data elements such as heap, stack, event loop state, resource 4401cb0ef41Sopenharmony_ci consumption etc. to reason about the fatal error. 4411cb0ef41Sopenharmony_ci 4421cb0ef41Sopenharmony_ci* `--report-compact` Write reports in a compact format, single-line JSON, more 4431cb0ef41Sopenharmony_ci easily consumable by log processing systems than the default multi-line format 4441cb0ef41Sopenharmony_ci designed for human consumption. 4451cb0ef41Sopenharmony_ci 4461cb0ef41Sopenharmony_ci* `--report-directory` Location at which the report will be 4471cb0ef41Sopenharmony_ci generated. 4481cb0ef41Sopenharmony_ci 4491cb0ef41Sopenharmony_ci* `--report-filename` Name of the file to which the report will be 4501cb0ef41Sopenharmony_ci written. 4511cb0ef41Sopenharmony_ci 4521cb0ef41Sopenharmony_ci* `--report-signal` Sets or resets the signal for report generation 4531cb0ef41Sopenharmony_ci (not supported on Windows). Default signal is `SIGUSR2`. 4541cb0ef41Sopenharmony_ci 4551cb0ef41Sopenharmony_ciA report can also be triggered via an API call from a JavaScript application: 4561cb0ef41Sopenharmony_ci 4571cb0ef41Sopenharmony_ci```js 4581cb0ef41Sopenharmony_ciprocess.report.writeReport(); 4591cb0ef41Sopenharmony_ci``` 4601cb0ef41Sopenharmony_ci 4611cb0ef41Sopenharmony_ciThis function takes an optional additional argument `filename`, which is 4621cb0ef41Sopenharmony_cithe name of a file into which the report is written. 4631cb0ef41Sopenharmony_ci 4641cb0ef41Sopenharmony_ci```js 4651cb0ef41Sopenharmony_ciprocess.report.writeReport('./foo.json'); 4661cb0ef41Sopenharmony_ci``` 4671cb0ef41Sopenharmony_ci 4681cb0ef41Sopenharmony_ciThis function takes an optional additional argument `err` which is an `Error` 4691cb0ef41Sopenharmony_ciobject that will be used as the context for the JavaScript stack printed in the 4701cb0ef41Sopenharmony_cireport. When using report to handle errors in a callback or an exception 4711cb0ef41Sopenharmony_cihandler, this allows the report to include the location of the original error as 4721cb0ef41Sopenharmony_ciwell as where it was handled. 4731cb0ef41Sopenharmony_ci 4741cb0ef41Sopenharmony_ci```js 4751cb0ef41Sopenharmony_citry { 4761cb0ef41Sopenharmony_ci process.chdir('/non-existent-path'); 4771cb0ef41Sopenharmony_ci} catch (err) { 4781cb0ef41Sopenharmony_ci process.report.writeReport(err); 4791cb0ef41Sopenharmony_ci} 4801cb0ef41Sopenharmony_ci// Any other code 4811cb0ef41Sopenharmony_ci``` 4821cb0ef41Sopenharmony_ci 4831cb0ef41Sopenharmony_ciIf both filename and error object are passed to `writeReport()` the 4841cb0ef41Sopenharmony_cierror object must be the second parameter. 4851cb0ef41Sopenharmony_ci 4861cb0ef41Sopenharmony_ci```js 4871cb0ef41Sopenharmony_citry { 4881cb0ef41Sopenharmony_ci process.chdir('/non-existent-path'); 4891cb0ef41Sopenharmony_ci} catch (err) { 4901cb0ef41Sopenharmony_ci process.report.writeReport(filename, err); 4911cb0ef41Sopenharmony_ci} 4921cb0ef41Sopenharmony_ci// Any other code 4931cb0ef41Sopenharmony_ci``` 4941cb0ef41Sopenharmony_ci 4951cb0ef41Sopenharmony_ciThe content of the diagnostic report can be returned as a JavaScript Object 4961cb0ef41Sopenharmony_civia an API call from a JavaScript application: 4971cb0ef41Sopenharmony_ci 4981cb0ef41Sopenharmony_ci```js 4991cb0ef41Sopenharmony_ciconst report = process.report.getReport(); 5001cb0ef41Sopenharmony_ciconsole.log(typeof report === 'object'); // true 5011cb0ef41Sopenharmony_ci 5021cb0ef41Sopenharmony_ci// Similar to process.report.writeReport() output 5031cb0ef41Sopenharmony_ciconsole.log(JSON.stringify(report, null, 2)); 5041cb0ef41Sopenharmony_ci``` 5051cb0ef41Sopenharmony_ci 5061cb0ef41Sopenharmony_ciThis function takes an optional additional argument `err`, which is an `Error` 5071cb0ef41Sopenharmony_ciobject that will be used as the context for the JavaScript stack printed in the 5081cb0ef41Sopenharmony_cireport. 5091cb0ef41Sopenharmony_ci 5101cb0ef41Sopenharmony_ci```js 5111cb0ef41Sopenharmony_ciconst report = process.report.getReport(new Error('custom error')); 5121cb0ef41Sopenharmony_ciconsole.log(typeof report === 'object'); // true 5131cb0ef41Sopenharmony_ci``` 5141cb0ef41Sopenharmony_ci 5151cb0ef41Sopenharmony_ciThe API versions are useful when inspecting the runtime state from within 5161cb0ef41Sopenharmony_cithe application, in expectation of self-adjusting the resource consumption, 5171cb0ef41Sopenharmony_ciload balancing, monitoring etc. 5181cb0ef41Sopenharmony_ci 5191cb0ef41Sopenharmony_ciThe content of the report consists of a header section containing the event 5201cb0ef41Sopenharmony_citype, date, time, PID, and Node.js version, sections containing JavaScript and 5211cb0ef41Sopenharmony_cinative stack traces, a section containing V8 heap information, a section 5221cb0ef41Sopenharmony_cicontaining `libuv` handle information, and an OS platform information section 5231cb0ef41Sopenharmony_cishowing CPU and memory usage and system limits. An example report can be 5241cb0ef41Sopenharmony_citriggered using the Node.js REPL: 5251cb0ef41Sopenharmony_ci 5261cb0ef41Sopenharmony_ci```console 5271cb0ef41Sopenharmony_ci$ node 5281cb0ef41Sopenharmony_ci> process.report.writeReport(); 5291cb0ef41Sopenharmony_ciWriting Node.js report to file: report.20181126.091102.8480.0.001.json 5301cb0ef41Sopenharmony_ciNode.js report completed 5311cb0ef41Sopenharmony_ci> 5321cb0ef41Sopenharmony_ci``` 5331cb0ef41Sopenharmony_ci 5341cb0ef41Sopenharmony_ciWhen a report is written, start and end messages are issued to stderr 5351cb0ef41Sopenharmony_ciand the filename of the report is returned to the caller. The default filename 5361cb0ef41Sopenharmony_ciincludes the date, time, PID, and a sequence number. The sequence number helps 5371cb0ef41Sopenharmony_ciin associating the report dump with the runtime state if generated multiple 5381cb0ef41Sopenharmony_citimes for the same Node.js process. 5391cb0ef41Sopenharmony_ci 5401cb0ef41Sopenharmony_ciDiagnostic report has an associated single-digit version number (`report.header.reportVersion`), 5411cb0ef41Sopenharmony_ciuniquely representing the report format. The version number is bumped 5421cb0ef41Sopenharmony_ciwhen new key is added or removed, or the data type of a value is changed. 5431cb0ef41Sopenharmony_ciReport version definitions are consistent across LTS releases. 5441cb0ef41Sopenharmony_ci 5451cb0ef41Sopenharmony_ci## Configuration 5461cb0ef41Sopenharmony_ci 5471cb0ef41Sopenharmony_ciAdditional runtime configuration of report generation is available via 5481cb0ef41Sopenharmony_cithe following properties of `process.report`: 5491cb0ef41Sopenharmony_ci 5501cb0ef41Sopenharmony_ci`reportOnFatalError` triggers diagnostic reporting on fatal errors when `true`. 5511cb0ef41Sopenharmony_ciDefaults to `false`. 5521cb0ef41Sopenharmony_ci 5531cb0ef41Sopenharmony_ci`reportOnSignal` triggers diagnostic reporting on signal when `true`. This is 5541cb0ef41Sopenharmony_cinot supported on Windows. Defaults to `false`. 5551cb0ef41Sopenharmony_ci 5561cb0ef41Sopenharmony_ci`reportOnUncaughtException` triggers diagnostic reporting on uncaught exception 5571cb0ef41Sopenharmony_ciwhen `true`. Defaults to `false`. 5581cb0ef41Sopenharmony_ci 5591cb0ef41Sopenharmony_ci`signal` specifies the POSIX signal identifier that will be used 5601cb0ef41Sopenharmony_cito intercept external triggers for report generation. Defaults to 5611cb0ef41Sopenharmony_ci`'SIGUSR2'`. 5621cb0ef41Sopenharmony_ci 5631cb0ef41Sopenharmony_ci`filename` specifies the name of the output file in the file system. 5641cb0ef41Sopenharmony_ciSpecial meaning is attached to `stdout` and `stderr`. Usage of these 5651cb0ef41Sopenharmony_ciwill result in report being written to the associated standard streams. 5661cb0ef41Sopenharmony_ciIn cases where standard streams are used, the value in `directory` is ignored. 5671cb0ef41Sopenharmony_ciURLs are not supported. Defaults to a composite filename that contains 5681cb0ef41Sopenharmony_citimestamp, PID, and sequence number. 5691cb0ef41Sopenharmony_ci 5701cb0ef41Sopenharmony_ci`directory` specifies the file system directory where the report will be 5711cb0ef41Sopenharmony_ciwritten. URLs are not supported. Defaults to the current working directory of 5721cb0ef41Sopenharmony_cithe Node.js process. 5731cb0ef41Sopenharmony_ci 5741cb0ef41Sopenharmony_ci```js 5751cb0ef41Sopenharmony_ci// Trigger report only on uncaught exceptions. 5761cb0ef41Sopenharmony_ciprocess.report.reportOnFatalError = false; 5771cb0ef41Sopenharmony_ciprocess.report.reportOnSignal = false; 5781cb0ef41Sopenharmony_ciprocess.report.reportOnUncaughtException = true; 5791cb0ef41Sopenharmony_ci 5801cb0ef41Sopenharmony_ci// Trigger report for both internal errors as well as external signal. 5811cb0ef41Sopenharmony_ciprocess.report.reportOnFatalError = true; 5821cb0ef41Sopenharmony_ciprocess.report.reportOnSignal = true; 5831cb0ef41Sopenharmony_ciprocess.report.reportOnUncaughtException = false; 5841cb0ef41Sopenharmony_ci 5851cb0ef41Sopenharmony_ci// Change the default signal to 'SIGQUIT' and enable it. 5861cb0ef41Sopenharmony_ciprocess.report.reportOnFatalError = false; 5871cb0ef41Sopenharmony_ciprocess.report.reportOnUncaughtException = false; 5881cb0ef41Sopenharmony_ciprocess.report.reportOnSignal = true; 5891cb0ef41Sopenharmony_ciprocess.report.signal = 'SIGQUIT'; 5901cb0ef41Sopenharmony_ci``` 5911cb0ef41Sopenharmony_ci 5921cb0ef41Sopenharmony_ciConfiguration on module initialization is also available via 5931cb0ef41Sopenharmony_cienvironment variables: 5941cb0ef41Sopenharmony_ci 5951cb0ef41Sopenharmony_ci```bash 5961cb0ef41Sopenharmony_ciNODE_OPTIONS="--report-uncaught-exception \ 5971cb0ef41Sopenharmony_ci --report-on-fatalerror --report-on-signal \ 5981cb0ef41Sopenharmony_ci --report-signal=SIGUSR2 --report-filename=./report.json \ 5991cb0ef41Sopenharmony_ci --report-directory=/home/nodeuser" 6001cb0ef41Sopenharmony_ci``` 6011cb0ef41Sopenharmony_ci 6021cb0ef41Sopenharmony_ciSpecific API documentation can be found under 6031cb0ef41Sopenharmony_ci[`process API documentation`][] section. 6041cb0ef41Sopenharmony_ci 6051cb0ef41Sopenharmony_ci## Interaction with workers 6061cb0ef41Sopenharmony_ci 6071cb0ef41Sopenharmony_ci<!-- YAML 6081cb0ef41Sopenharmony_cichanges: 6091cb0ef41Sopenharmony_ci - version: 6101cb0ef41Sopenharmony_ci - v13.9.0 6111cb0ef41Sopenharmony_ci - v12.16.2 6121cb0ef41Sopenharmony_ci pr-url: https://github.com/nodejs/node/pull/31386 6131cb0ef41Sopenharmony_ci description: Workers are now included in the report. 6141cb0ef41Sopenharmony_ci--> 6151cb0ef41Sopenharmony_ci 6161cb0ef41Sopenharmony_ci[`Worker`][] threads can create reports in the same way that the main thread 6171cb0ef41Sopenharmony_cidoes. 6181cb0ef41Sopenharmony_ci 6191cb0ef41Sopenharmony_ciReports will include information on any Workers that are children of the current 6201cb0ef41Sopenharmony_cithread as part of the `workers` section, with each Worker generating a report 6211cb0ef41Sopenharmony_ciin the standard report format. 6221cb0ef41Sopenharmony_ci 6231cb0ef41Sopenharmony_ciThe thread which is generating the report will wait for the reports from Worker 6241cb0ef41Sopenharmony_cithreads to finish. However, the latency for this will usually be low, as both 6251cb0ef41Sopenharmony_cirunning JavaScript and the event loop are interrupted to generate the report. 6261cb0ef41Sopenharmony_ci 6271cb0ef41Sopenharmony_ci[`Worker`]: worker_threads.md 6281cb0ef41Sopenharmony_ci[`process API documentation`]: process.md 629