JDK-8300119 : CgroupMetrics.getTotalMemorySize0() can report invalid results on 32 bit systems
  • Type: Bug
  • Component: core-svc
  • Sub-Component: java.lang.management
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2023-01-13
  • Updated: 2025-06-14
  • Resolved: 2023-01-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 17 JDK 21 JDK 8 Other
11.0.19Fixed 17.0.7Fixed 21 b07Fixed 8u381Fixed openjdk8u372,shenandoah8u372Fixed
Related Reports
Relates :  
Description
JDK-8292541 introduced JNI method Java_jdk_internal_platform_CgroupMetrics_getTotalMemorySize0. During the effort to backport it to jdk8u-dev, We have discovered that it can return an invalid value on x86 (32 bit) systems.

On a system with 7281311744 bytes of total memory the function would return: -1308622848 suggesting some overflow occurring.

This was caught with the tier1 test:
TestMemoryAwareness.testContainerMemExceedsPhysical.

See this discussion on GitHub for further details
https://github.com/openjdk/jdk8u-dev/pull/220#pullrequestreview-1247595245
Comments
A pull request was submitted for review. URL: https://git.openjdk.org/jdk11u-dev/pull/1672 Date: 2023-01-19 15:43:06 +0000
19-01-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk17u-dev/pull/1086 Date: 2023-01-19 15:41:25 +0000
19-01-2023

Fix Request (11u, 17u): Trivial clean backport to keep code in sync. We had to fix this in 8u372 and would like for the code to be in later JDKs as well. Functional no-op so low risk on most arches. Fixes an issue on some 32 bit builds (corner case).
19-01-2023

Changeset: dea58efb Author: Jonathan Dowland <jdowland@openjdk.org> Committer: Severin Gehwolf <sgehwolf@openjdk.org> Date: 2023-01-19 13:26:18 +0000 URL: https://git.openjdk.org/jdk/commit/dea58efb6280bb1d94daf208ac909aa013439397
19-01-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/12069 Date: 2023-01-18 13:20:06 +0000
18-01-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk8u-dev/pull/220 Date: 2023-01-03 11:46:29 +0000
13-01-2023