Skip to content

Conversation

@sendaoYan
Copy link
Member

@sendaoYan sendaoYan commented Dec 26, 2025

Hi all,

Test jdk/internal/platform/cgroup/TestCgroupMetrics.java report fails when the cpuset unmounted. The details shows in jbs issue. I think it's better to check the 'cpu period' or 'cpuset' available or not before run the releated tests.

Change has been verified locally. Test-fix only, no risk.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8374364: TestCgroupMetrics.java fails when cpuset unmounted (Bug - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/28996/head:pull/28996
$ git checkout pull/28996

Update a local copy of the PR:
$ git checkout pull/28996
$ git pull https://git.openjdk.org/jdk.git pull/28996/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 28996

View PR using the GUI difftool:
$ git pr show -t 28996

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/28996.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 26, 2025

👋 Welcome back syan! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Dec 26, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk
Copy link

openjdk bot commented Dec 26, 2025

@sendaoYan The following labels will be automatically applied to this pull request:

  • core-libs
  • serviceability

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the rfr Pull request is ready for review label Dec 26, 2025
@mlbridge
Copy link

mlbridge bot commented Dec 26, 2025

Webrevs

@DamonFool
Copy link
Member

So MetricsTester.main(args) requires the docker service, right?

Maybe it would be better to add this check in a place likeMetricsTester, where it requires docker service directly.

@sendaoYan
Copy link
Member Author

sendaoYan commented Dec 26, 2025

So MetricsTester.main(args) requires the docker service, right?

Maybe it would be better to add this check in a place likeMetricsTester, where it requires docker service directly.

Only jdk/internal/platform/cgroup/TestCgroupMetrics.java observed fails when docker service unavailable. There are total two tests invoke MetricsTester. The other test jdk/internal/platform/docker/TestSystemMetrics.java already call DockerTestUtils.checkCanTestDocker() before start test. So i think it's better to leave this check inside test, same like to jdk/internal/platform/docker/TestSystemMetrics.java.

@DamonFool
Copy link
Member

So i think it's better to leave this check inside test, same like to jdk/internal/platform/docker/TestSystemMetrics.java.

I don't think so.

Just imagine someone may call MetricsTester.main(args) again in the future, how can you prevent him/her not forgetting adding the check before the call?

That's why I would suggest adding it in the place where it requires docker directly, not the place indirectly.

@openjdk
Copy link

openjdk bot commented Dec 26, 2025

@sendaoYan hotspot-runtime has been added to this pull request based on files touched in new commit(s).

@sendaoYan
Copy link
Member Author

That's why I would suggest adding it in the place where it requires docker directly, not the place indirectly.

Fixed.

@sendaoYan
Copy link
Member Author

/issue JDK-8374364

@openjdk openjdk bot changed the title 8374364: TestCgroupMetrics.java fails when docker service unavailable 8374364: TestCgroupMetrics.java fails when cpuset unmounted Dec 29, 2025
@openjdk
Copy link

openjdk bot commented Dec 29, 2025

@sendaoYan This issue is referenced in the PR title - it will now be updated.

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

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

A couple of comments but I'm not sure what the right approach is here. Seems inconsistent to use SkippedException in one place, but not others.

CgroupV1Metrics metrics = (CgroupV1Metrics)Metrics.systemMetrics();
long oldVal = metrics.getCpuPeriod();
if (oldVal == CgroupSubsystem.LONG_RETVAL_UNLIMITED) {
System.out.println("Get cpu period fails, test skipped.");
Copy link
Member

Choose a reason for hiding this comment

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

Note sure this indicates a "fail" as such.

Copy link
Member Author

@sendaoYan sendaoYan Jan 6, 2026

Choose a reason for hiding this comment

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

The getCpuPeriod call getLongValue to read property value from file /sys/fs/cgroup/cpu,cpuacct/system.slice/sshd.service/cpu.cfs_period_us. The getLongValue will return CgroupSubsystem.LONG_RETVAL_UNLIMITED if it can not open the file. So I think it's better to skip this sub-test when there is no /sys/fs/cgroup/cpu,cpuacct/system.slice/sshd.service/cpu.cfs_period_us file.

@sendaoYan
Copy link
Member Author

A couple of comments but I'm not sure what the right approach is here. Seems inconsistent to use SkippedException in one place, but not others.

This PR use SkippedException instead of report test pass. It's unrelated to the subject, It just fix it by the way

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants