Skip to content

[BUG] Probes.getLoadAndScaleToPercent started to fail on some systems with JDK 24 #18561

@mishail

Description

@mishail

Describe the bug

We started to see some strange test failures in our CI after #18085, where JDK 24 was introduced. AdmissionControlSingleNodeTests.testAdmissionControlRejectionMonitorOnlyMode and AdmissionControlSingleNodeTests.testAdmissionControlRejectionEnforcedMode specifically.

Those test expect requests to be rejected with a failure based on some CPU-load based policies, but that didn't happen for some reason. After spending some time I found that AverageCpuUsageTracker.getAverage started returning -1 in our CI.

Digging deeper I found that the cause is indeed in the security.policy (similar to #18548).
So with JDK 24 these permissions are now required as well:

  permission java.io.FilePermission "/sys/fs/cgroup/cpu.max", "read";
  permission java.io.FilePermission "/sys/fs/cgroup/cpu.weight", "read";
  permission java.io.FilePermission "/sys/fs/cgroup/cpuset.cpus", "read";
  permission java.io.FilePermission "/sys/fs/cgroup/cpuset.cpus.effective", "read";

I'can tell which exactly systems might be affected as I wasn't able to reproduce on my macOS and build.ci.opensearch.org doesn't have these failures.

These are the stack traces to prove my point:

Related component

Build

To Reproduce

Run ./gradlew test on a system that uses CgroupV2Subsystem implementation of CgroupSubsystem

Expected behavior

Tests pass

Additional Details

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions