Skip to content

8346875: Test jdk/jdk/jfr/event/os/TestCPULoad.java fails on macOS#23136

Closed
MBaesken wants to merge 2 commits intoopenjdk:masterfrom
MBaesken:JDK-8346875
Closed

8346875: Test jdk/jdk/jfr/event/os/TestCPULoad.java fails on macOS#23136
MBaesken wants to merge 2 commits intoopenjdk:masterfrom
MBaesken:JDK-8346875

Conversation

@MBaesken
Copy link
Member

@MBaesken MBaesken commented Jan 15, 2025

The test fails on some new Mac instances (macOS 14.5 (macOS aarch64) , CPU Apple M2) with :
java.lang.AssertionError: Expected at least one event
at jdk.jfr.event.os.TestCPULoad.main(TestCPULoad.java:62)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:565)
at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
at java.base/java.lang.Thread.run(Thread.java:1447)

The current sleep value seems to be a bit too slow for those machines. The issues occured (mostly) with fastdebug binaries.


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-8346875: Test jdk/jdk/jfr/event/os/TestCPULoad.java fails on macOS (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 23136

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 15, 2025

👋 Welcome back mbaesken! 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 Jan 15, 2025

@MBaesken This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8346875: Test jdk/jdk/jfr/event/os/TestCPULoad.java fails on macOS

Reviewed-by: egahlin

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 23 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot changed the title JDK-8346875: Test jdk/jdk/jfr/event/os/TestCPULoad.java fails on macOS 8346875: Test jdk/jdk/jfr/event/os/TestCPULoad.java fails on macOS Jan 15, 2025
@openjdk openjdk bot added the rfr Pull request is ready for review label Jan 15, 2025
@openjdk
Copy link

openjdk bot commented Jan 15, 2025

@MBaesken The following label will be automatically applied to this pull request:

  • hotspot-jfr

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

@openjdk openjdk bot added the hotspot-jfr hotspot-jfr-dev@openjdk.org label Jan 15, 2025
@mlbridge
Copy link

mlbridge bot commented Jan 15, 2025

Webrevs

@egahlin
Copy link
Member

egahlin commented Jan 16, 2025

Do you think it is this line that prevents us from getting a sample.

if (total_delta == 0) {

Maybe we should do some work instead of additional sleeping?

@MBaesken
Copy link
Member Author

Not sure if it is this line. Should we maybe add some UL tracing; enable it for the test and see if we hit this ?

Maybe we should do some work instead of additional sleeping?

Could be that this helps; or increase the sleep time (but less than I did) AND do some CPU intensive work .

@egahlin
Copy link
Member

egahlin commented Jan 16, 2025

Could be that this helps; or increase the sleep time (but less than I did) AND do some CPU intensive work .

You could keep the 100 ms and do some CPU intensive work. If it still fails, then we'll know it's not CPU work related. If we change both at once, it's harder to analyze.

If I remember correctly, we didn't have sleep at all initially (2012). Then we had a smaller sleep which was later increased to 100 ms. We should probably have tried to add CPU related work instead of increasing the sleep time.

@MBaesken
Copy link
Member Author

Hi Erik, I added some code doing a few calculations. Let's see if this is good .

Copy link
Member

@egahlin egahlin left a comment

Choose a reason for hiding this comment

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

I tried running the test 100 times on different operating systems and hardware. No failures. Let's try this.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jan 16, 2025
@MBaesken
Copy link
Member Author

Hi Erik, thanks for the review ! Let's see if this is better than the sleep (or maybe we need both, sleep and cycle burning) .

/integrate

@openjdk
Copy link

openjdk bot commented Jan 17, 2025

Going to push as commit a3eef6c.
Since your change was applied there have been 27 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jan 17, 2025
@openjdk openjdk bot closed this Jan 17, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jan 17, 2025
@openjdk
Copy link

openjdk bot commented Jan 17, 2025

@MBaesken Pushed as commit a3eef6c.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@MBaesken
Copy link
Member Author

Hi Erik @egahlin , we unfortunately still sometimes see the error after this change

----------System.out:(1/41)----------
Found 183072 primes while burning cycles
----------System.err:(11/642)----------
java.lang.AssertionError: Expected at least one event
at jdk.jfr.event.os.TestCPULoad.main(TestCPULoad.java:80)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:565)
at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
at java.base/java.lang.Thread.run(Thread.java:1447)

So burning cycles did not really help .

@egahlin
Copy link
Member

egahlin commented Jan 24, 2025

Hi Erik @egahlin , we unfortunately still sometimes see the error after this change

I've noticed the same thing when running them in parallel, i.e.,

$ jtreg -conc:32 -v:a -jdk ... test/jdk/jdk/jfr 

You could try adding logging (log_debug(jfr, system)("...")) and see if you can reproduce the issue. If it's not a product bug, you could try to use an event stream instead.

public static void main(String... args) throws Exception {
  List<RecordedEvent> events = new ArrayList<>();
  try (var rs = new RecordingStream()) {
    rs.setReuse(false);
    rs.enable("jdk.CPULoad").withPeriod(Duration.ofMillis(50));
    rs.onEvent(e -> {
      events.add(e);
      rs.close();
    });
    rs.start();
    verifyEvent(events.getFirst());
  }
}

private static void verifyEvent(RecordedEvent e) throws Exception {
  ...
}`

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

Labels

hotspot-jfr hotspot-jfr-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

2 participants