Skip to content

Fix CProcessStats RSS units and initialization#2917

Merged
valeriy42 merged 2 commits intoelastic:mainfrom
valeriy42:fix/rss-initialization
Mar 6, 2026
Merged

Fix CProcessStats RSS units and initialization#2917
valeriy42 merged 2 commits intoelastic:mainfrom
valeriy42:fix/rss-initialization

Conversation

@valeriy42
Copy link
Contributor

Fixes two bugs in residentSetSize() on Linux:

  • Initialize rss to 0 (prevents UB if /proc/self/statm unreadable)
  • Convert from pages to bytes using sysconf(_SC_PAGE_SIZE) (was ~4096x too small)

@prodsecmachine
Copy link

prodsecmachine commented Feb 25, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@valeriy42 valeriy42 requested a review from edsavage February 25, 2026 09:28
Copy link
Contributor

@edsavage edsavage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Interesting, good spot!

@valeriy42 valeriy42 merged commit 46f3b00 into elastic:main Mar 6, 2026
11 checks passed
@valeriy42 valeriy42 deleted the fix/rss-initialization branch March 6, 2026 10:30
@github-actions
Copy link

github-actions bot commented Mar 6, 2026

💔 All backports failed

Status Branch Result
9.2 Backport failed because of merge conflicts

You might need to backport the following PRs to 9.2:
- [ML] Add resource monitoring in CBucketGatherer::addEventData (#2848)
- [ML] Upgrade to PyTorch 2.7.1 (#2863)
- [ML] Report the "actual" memory usage of the autodetect process (#2846)
9.3 Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

backport --pr 2917

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

valeriy42 added a commit to valeriy42/ml-cpp that referenced this pull request Mar 6, 2026
Fixes two bugs in residentSetSize() on Linux:

Initialize rss to 0 (prevents UB if /proc/self/statm unreadable)
Convert from pages to bytes using sysconf(_SC_PAGE_SIZE) (was ~4096x too small)

(cherry picked from commit 46f3b00)

# Conflicts:
#	docs/CHANGELOG.asciidoc
@valeriy42
Copy link
Contributor Author

💔 Some backports could not be created

Status Branch Result
9.3
9.2 Conflict resolution was aborted by the user

Manual backport

To create the backport manually run:

backport --pr 2917

Questions ?

Please refer to the Backport tool documentation

valeriy42 added a commit to valeriy42/ml-cpp that referenced this pull request Mar 6, 2026
Fixes two bugs in residentSetSize() on Linux:

Initialize rss to 0 (prevents UB if /proc/self/statm unreadable)
Convert from pages to bytes using sysconf(_SC_PAGE_SIZE) (was ~4096x too small)

(cherry picked from commit 46f3b00)

# Conflicts:
#	docs/CHANGELOG.asciidoc
@valeriy42
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
9.2

Questions ?

Please refer to the Backport tool documentation

valeriy42 added a commit that referenced this pull request Mar 11, 2026
Fixes two bugs in residentSetSize() on Linux:

Initialize rss to 0 (prevents UB if /proc/self/statm unreadable)
Convert from pages to bytes using sysconf(_SC_PAGE_SIZE) (was ~4096x too small)

(cherry picked from commit 46f3b00)
valeriy42 added a commit that referenced this pull request Mar 11, 2026
)

* [ML] Fix CProcessStats RSS units and initialization (#2917)

Fixes two bugs in residentSetSize() on Linux:

Initialize rss to 0 (prevents UB if /proc/self/statm unreadable)
Convert from pages to bytes using sysconf(_SC_PAGE_SIZE) (was ~4096x too small)

(cherry picked from commit 46f3b00)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants