Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

report: fix typos in memory limit units #56068

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 39 additions & 4 deletions doc/api/report.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ is provided below for reference.
```json
{
"header": {
"reportVersion": 4,
"reportVersion": 5,
"event": "exception",
"trigger": "Exception",
"filename": "report.20181221.005011.8974.0.001.json",
Expand Down Expand Up @@ -392,7 +392,7 @@ is provided below for reference.
"soft": "",
"hard": "unlimited"
},
"data_seg_size_kbytes": {
"data_seg_size_bytes": {
"soft": "unlimited",
"hard": "unlimited"
},
Expand All @@ -404,7 +404,7 @@ is provided below for reference.
"soft": "unlimited",
"hard": 65536
},
"max_memory_size_kbytes": {
"max_memory_size_bytes": {
"soft": "unlimited",
"hard": "unlimited"
},
Expand All @@ -424,7 +424,7 @@ is provided below for reference.
"soft": "unlimited",
"hard": 4127290
},
"virtual_memory_kbytes": {
"virtual_memory_bytes": {
"soft": "unlimited",
"hard": "unlimited"
}
Expand Down Expand Up @@ -588,6 +588,41 @@ Report version definitions are consistent across LTS releases.

### Version history

#### Version 5

<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/56068
description: Fix typos in the memory limit units.
-->

Replace the keys `data_seg_size_kbytes`, `max_memory_size_kbytes`, and `virtual_memory_kbytes`
with `data_seg_size_bytes`, `max_memory_size_bytes`, and `virtual_memory_bytes`
respectively in the `userLimits` section, as these values are given in bytes.

```json
{
"userLimits": {
// Skip some keys ...
"data_seg_size_bytes": { // replacing data_seg_size_kbytes
"soft": "unlimited",
"hard": "unlimited"
},
// ...
"max_memory_size_bytes": { // replacing max_memory_size_kbytes
"soft": "unlimited",
"hard": "unlimited"
},
// ...
"virtual_memory_bytes": { // replacing virtual_memory_kbytes
"soft": "unlimited",
"hard": "unlimited"
}
}
}
```

#### Version 4

<!-- YAML
Expand Down
8 changes: 4 additions & 4 deletions src/node_report.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <cwctype>
#include <fstream>

constexpr int NODE_REPORT_VERSION = 4;
constexpr int NODE_REPORT_VERSION = 5;
constexpr int NANOS_PER_SEC = 1000 * 1000 * 1000;
constexpr double SEC_PER_MICROS = 1e-6;
constexpr int MAX_FRAME_COUNT = node::kMaxFrameCountForLogging;
Expand Down Expand Up @@ -732,13 +732,13 @@ static void PrintSystemInformation(JSONWriter* writer) {
int id;
} rlimit_strings[] = {
{"core_file_size_blocks", RLIMIT_CORE},
{"data_seg_size_kbytes", RLIMIT_DATA},
{"data_seg_size_bytes", RLIMIT_DATA},
technic960183 marked this conversation as resolved.
Show resolved Hide resolved
{"file_size_blocks", RLIMIT_FSIZE},
#if !(defined(_AIX) || defined(__sun))
{"max_locked_memory_bytes", RLIMIT_MEMLOCK},
#endif
#ifndef __sun
{"max_memory_size_kbytes", RLIMIT_RSS},
{"max_memory_size_bytes", RLIMIT_RSS},
#endif
{"open_files", RLIMIT_NOFILE},
{"stack_size_bytes", RLIMIT_STACK},
Expand All @@ -747,7 +747,7 @@ static void PrintSystemInformation(JSONWriter* writer) {
{"max_user_processes", RLIMIT_NPROC},
#endif
#ifndef __OpenBSD__
{"virtual_memory_kbytes", RLIMIT_AS}
{"virtual_memory_bytes", RLIMIT_AS}
#endif
};

Expand Down
8 changes: 4 additions & 4 deletions test/common/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function _validateContent(report, fields = []) {
'glibcVersionRuntime', 'glibcVersionCompiler', 'cwd',
'reportVersion', 'networkInterfaces', 'threadId'];
checkForUnknownFields(header, headerFields);
assert.strictEqual(header.reportVersion, 4); // Increment as needed.
assert.strictEqual(header.reportVersion, 5); // Increment as needed.
assert.strictEqual(typeof header.event, 'string');
assert.strictEqual(typeof header.trigger, 'string');
assert(typeof header.filename === 'string' || header.filename === null);
Expand Down Expand Up @@ -309,11 +309,11 @@ function _validateContent(report, fields = []) {

// Verify the format of the userLimits section on non-Windows platforms.
if (!isWindows) {
const userLimitsFields = ['core_file_size_blocks', 'data_seg_size_kbytes',
const userLimitsFields = ['core_file_size_blocks', 'data_seg_size_bytes',
'file_size_blocks', 'max_locked_memory_bytes',
'max_memory_size_kbytes', 'open_files',
'max_memory_size_bytes', 'open_files',
'stack_size_bytes', 'cpu_time_seconds',
'max_user_processes', 'virtual_memory_kbytes'];
'max_user_processes', 'virtual_memory_bytes'];
checkForUnknownFields(report.userLimits, userLimitsFields);
for (const [type, limits] of Object.entries(report.userLimits)) {
assert.strictEqual(typeof type, 'string');
Expand Down
Loading