Skip to content

Commit 50ec6f9

Browse files
technic960183targos
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 af02a55 commit 50ec6f9

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
@@ -35,7 +35,7 @@ is provided below for reference.
3535
```json
3636
{
3737
"header": {
38-
"reportVersion": 4,
38+
"reportVersion": 5,
3939
"event": "exception",
4040
"trigger": "Exception",
4141
"filename": "report.20181221.005011.8974.0.001.json",
@@ -392,7 +392,7 @@ is provided below for reference.
392392
"soft": "",
393393
"hard": "unlimited"
394394
},
395-
"data_seg_size_kbytes": {
395+
"data_seg_size_bytes": {
396396
"soft": "unlimited",
397397
"hard": "unlimited"
398398
},
@@ -404,7 +404,7 @@ is provided below for reference.
404404
"soft": "unlimited",
405405
"hard": 65536
406406
},
407-
"max_memory_size_kbytes": {
407+
"max_memory_size_bytes": {
408408
"soft": "unlimited",
409409
"hard": "unlimited"
410410
},
@@ -424,7 +424,7 @@ is provided below for reference.
424424
"soft": "unlimited",
425425
"hard": 4127290
426426
},
427-
"virtual_memory_kbytes": {
427+
"virtual_memory_bytes": {
428428
"soft": "unlimited",
429429
"hard": "unlimited"
430430
}
@@ -588,6 +588,41 @@ Report version definitions are consistent across LTS releases.
588588

589589
### Version history
590590

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

593628
<!-- 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)