Skip to content

Commit 4aa768a

Browse files
technic960183ruyadorno
authored andcommitted
report: fix typos in report keys and bump the version
Replace "kbytes" with "bytes" in `PrintSystemInformation()` in `src/node_report.cc`, as RLIMIT_DATA, RLIMIT_RSS, and RLIMIT_AS are given in bytes. The report version is bumped from 4 to 5. Refs: https://www.ibm.com/docs/en/aix/7.3?topic=k-kgetrlimit64-kernel-service PR-URL: #56068 Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 6ae43a5 commit 4aa768a

File tree

3 files changed

+47
-12
lines changed

3 files changed

+47
-12
lines changed

doc/api/report.md

+39-4
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ is provided below for reference.
3333
```json
3434
{
3535
"header": {
36-
"reportVersion": 4,
36+
"reportVersion": 5,
3737
"event": "exception",
3838
"trigger": "Exception",
3939
"filename": "report.20181221.005011.8974.0.001.json",
@@ -390,7 +390,7 @@ is provided below for reference.
390390
"soft": "",
391391
"hard": "unlimited"
392392
},
393-
"data_seg_size_kbytes": {
393+
"data_seg_size_bytes": {
394394
"soft": "unlimited",
395395
"hard": "unlimited"
396396
},
@@ -402,7 +402,7 @@ is provided below for reference.
402402
"soft": "unlimited",
403403
"hard": 65536
404404
},
405-
"max_memory_size_kbytes": {
405+
"max_memory_size_bytes": {
406406
"soft": "unlimited",
407407
"hard": "unlimited"
408408
},
@@ -422,7 +422,7 @@ is provided below for reference.
422422
"soft": "unlimited",
423423
"hard": 4127290
424424
},
425-
"virtual_memory_kbytes": {
425+
"virtual_memory_bytes": {
426426
"soft": "unlimited",
427427
"hard": "unlimited"
428428
}
@@ -586,6 +586,41 @@ Report version definitions are consistent across LTS releases.
586586

587587
### Version history
588588

589+
#### Version 5
590+
591+
<!-- YAML
592+
changes:
593+
- version: REPLACEME
594+
pr-url: https://github.com/nodejs/node/pull/56068
595+
description: Fix typos in the memory limit units.
596+
-->
597+
598+
Replace the keys `data_seg_size_kbytes`, `max_memory_size_kbytes`, and `virtual_memory_kbytes`
599+
with `data_seg_size_bytes`, `max_memory_size_bytes`, and `virtual_memory_bytes`
600+
respectively in the `userLimits` section, as these values are given in bytes.
601+
602+
```json
603+
{
604+
"userLimits": {
605+
// Skip some keys ...
606+
"data_seg_size_bytes": { // replacing data_seg_size_kbytes
607+
"soft": "unlimited",
608+
"hard": "unlimited"
609+
},
610+
// ...
611+
"max_memory_size_bytes": { // replacing max_memory_size_kbytes
612+
"soft": "unlimited",
613+
"hard": "unlimited"
614+
},
615+
// ...
616+
"virtual_memory_bytes": { // replacing virtual_memory_kbytes
617+
"soft": "unlimited",
618+
"hard": "unlimited"
619+
}
620+
}
621+
}
622+
```
623+
589624
#### Version 4
590625

591626
<!-- YAML

src/node_report.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include <cwctype>
2424
#include <fstream>
2525

26-
constexpr int NODE_REPORT_VERSION = 4;
26+
constexpr int NODE_REPORT_VERSION = 5;
2727
constexpr int NANOS_PER_SEC = 1000 * 1000 * 1000;
2828
constexpr double SEC_PER_MICROS = 1e-6;
2929
constexpr int MAX_FRAME_COUNT = node::kMaxFrameCountForLogging;
@@ -732,13 +732,13 @@ static void PrintSystemInformation(JSONWriter* writer) {
732732
int id;
733733
} rlimit_strings[] = {
734734
{"core_file_size_blocks", RLIMIT_CORE},
735-
{"data_seg_size_kbytes", RLIMIT_DATA},
735+
{"data_seg_size_bytes", RLIMIT_DATA},
736736
{"file_size_blocks", RLIMIT_FSIZE},
737737
#if !(defined(_AIX) || defined(__sun))
738738
{"max_locked_memory_bytes", RLIMIT_MEMLOCK},
739739
#endif
740740
#ifndef __sun
741-
{"max_memory_size_kbytes", RLIMIT_RSS},
741+
{"max_memory_size_bytes", RLIMIT_RSS},
742742
#endif
743743
{"open_files", RLIMIT_NOFILE},
744744
{"stack_size_bytes", RLIMIT_STACK},
@@ -747,7 +747,7 @@ static void PrintSystemInformation(JSONWriter* writer) {
747747
{"max_user_processes", RLIMIT_NPROC},
748748
#endif
749749
#ifndef __OpenBSD__
750-
{"virtual_memory_kbytes", RLIMIT_AS}
750+
{"virtual_memory_bytes", RLIMIT_AS}
751751
#endif
752752
};
753753

test/common/report.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ function _validateContent(report, fields = []) {
110110
'glibcVersionRuntime', 'glibcVersionCompiler', 'cwd',
111111
'reportVersion', 'networkInterfaces', 'threadId'];
112112
checkForUnknownFields(header, headerFields);
113-
assert.strictEqual(header.reportVersion, 4); // Increment as needed.
113+
assert.strictEqual(header.reportVersion, 5); // Increment as needed.
114114
assert.strictEqual(typeof header.event, 'string');
115115
assert.strictEqual(typeof header.trigger, 'string');
116116
assert(typeof header.filename === 'string' || header.filename === null);
@@ -309,11 +309,11 @@ function _validateContent(report, fields = []) {
309309

310310
// Verify the format of the userLimits section on non-Windows platforms.
311311
if (!isWindows) {
312-
const userLimitsFields = ['core_file_size_blocks', 'data_seg_size_kbytes',
312+
const userLimitsFields = ['core_file_size_blocks', 'data_seg_size_bytes',
313313
'file_size_blocks', 'max_locked_memory_bytes',
314-
'max_memory_size_kbytes', 'open_files',
314+
'max_memory_size_bytes', 'open_files',
315315
'stack_size_bytes', 'cpu_time_seconds',
316-
'max_user_processes', 'virtual_memory_kbytes'];
316+
'max_user_processes', 'virtual_memory_bytes'];
317317
checkForUnknownFields(report.userLimits, userLimitsFields);
318318
for (const [type, limits] of Object.entries(report.userLimits)) {
319319
assert.strictEqual(typeof type, 'string');

0 commit comments

Comments
 (0)