Skip to content

8354257: xctracenorm profiler not working with JDK JMH benchmarks#24571

Closed
galderz wants to merge 1 commit intoopenjdk:masterfrom
galderz:topic.missing-instruments-xml
Closed

8354257: xctracenorm profiler not working with JDK JMH benchmarks#24571
galderz wants to merge 1 commit intoopenjdk:masterfrom
galderz:topic.missing-instruments-xml

Conversation

@galderz
Copy link
Contributor

@galderz galderz commented Apr 10, 2025

Avoid filtering out xml files at the root of the JMH folder, in order to get the default.instruments.template.xml file bundled in the JMH core jar to support xtrace profiler.


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

Warning

 ⚠️ Found leading lowercase letter in issue title for 8354257: xctracenorm profiler not working with JDK JMH benchmarks

Issue

  • JDK-8354257: xctracenorm profiler not working with JDK JMH benchmarks (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 24571

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 10, 2025

👋 Welcome back galder! 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 Apr 10, 2025

@galderz 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:

8354257: xctracenorm profiler not working with JDK JMH benchmarks

Reviewed-by: ihse

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 444 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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@magicus) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the rfr Pull request is ready for review label Apr 10, 2025
@openjdk
Copy link

openjdk bot commented Apr 10, 2025

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

  • build

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 build build-dev@openjdk.org label Apr 10, 2025
@mlbridge
Copy link

mlbridge bot commented Apr 10, 2025

Webrevs

@erikj79
Copy link
Member

erikj79 commented Apr 10, 2025

The jmh-core jar file published in Maven central (https://repo.maven.apache.org/maven2/org/openjdk/jmh/jmh-core/1.37/jmh-core-1.37.jar), which is the one referenced from the devkit generator script, does not contain this default.instruments.template.xml file. The rm command seems to be aimed at checkstyle.xml and findbugs.xml, both of which I would assume to be irrelevant, but should also be benign, but I can't help but wonder why those files are included in the JMH distribution. In what kind of build configuration do you get default.instruments.template.xml bundled?

Unfortunately, the original author of the JDK build logic for micro benchmarks isn't available atm. I don't know enough about JMH to say if this is a reasonable change. Maybe @shipilev can fill in with some knowledge?

@shipilev
Copy link
Member

xtraceasm was not released yet in any JMH version, it is going to be in 1.38. So what is the problem here? @galderz, have you dropped the snapshot JMH JARs, and it fails to run with -prof xtraceasm?

@galderz
Copy link
Contributor Author

galderz commented Apr 15, 2025

@shipilev Yes I'm using the latest JMH source code snapshot to try out xtrace profiler locally. -prof xctraceasm works fine as is, but -prof xctracenorm fails. The problem is explained in JDK-8354257.

@magicus
Copy link
Member

magicus commented Apr 28, 2025

My understanding here is that we unpack four different jars: jmh-core, jmh-generator-annprocess, jopt-simple and commons-math3. The removal of *.xml is done on the single directory where all of the jars were unpacked into, so the intended target could be xml files in any of these, not just jmh-core .

@magicus
Copy link
Member

magicus commented Apr 28, 2025

With that said, it is very much unclear why this line is here at all. The removal of xml files is from the original integration of microbenchmarks, JDK-8061281, and the reason behind it is lost in time.

But if this works, and does not break any existing microbenchmark tests, I don't see any problem.

@erikj79
Copy link
Member

erikj79 commented Apr 28, 2025

With that said, it is very much unclear why this line is here at all. The removal of xml files is from the original integration of microbenchmarks, JDK-8061281, and the reason behind it is lost in time.

As I wrote above:

The rm command seems to be aimed at checkstyle.xml and findbugs.xml, both of which I would assume to be irrelevant, but should also be benign, but I can't help but wonder why those files are included in the JMH distribution.

That was based on inspecting all 4 jars. I highly doubt there was anything more sinister or dangerous hidden in any of the jar files historically. These seemingly irrelevant files seem enough to have warranted this file removal to me at least. I do think it's a bug that JMH is bundling its checkstyle and findbugs configurations in its distribution jar, so perhaps we can suggest to a JMH maintainer to stop doing that. :)

Regardless, the files should be benign so removing the rm line seems fine to me.

@galderz
Copy link
Contributor Author

galderz commented Apr 30, 2025

I do think it's a bug that JMH is bundling its checkstyle and findbugs configurations in its distribution jar, so perhaps we can suggest to a JMH maintainer to stop doing that. :)

I think that makes sense to me and I can try to do that. Both files could be moved to src/test/resources, modify the jmh-core pom.xml to files there instead. The combination of both would stop those xml from ending in the distribution jar.

@galderz
Copy link
Contributor Author

galderz commented Apr 30, 2025

I do think it's a bug that JMH is bundling its checkstyle and findbugs configurations in its distribution jar, so perhaps we can suggest to a JMH maintainer to stop doing that. :)

I think that makes sense to me and I can try to do that. Both files could be moved to src/test/resources, modify the jmh-core pom.xml to files there instead. The combination of both would stop those xml from ending in the distribution jar.

I've created CODETOOLS-7903998 to track this.

Copy link
Member

@magicus magicus left a comment

Choose a reason for hiding this comment

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

I apparently missed to approve this. I think this fix looks sane, regardless of any upstream changes.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label May 5, 2025
@galderz
Copy link
Contributor Author

galderz commented May 7, 2025

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label May 7, 2025
@openjdk
Copy link

openjdk bot commented May 7, 2025

@galderz
Your change (at version a2b73be) is now ready to be sponsored by a Committer.

@magicus
Copy link
Member

magicus commented May 7, 2025

/sponsor

@openjdk
Copy link

openjdk bot commented May 7, 2025

Going to push as commit 772c970.
Since your change was applied there have been 445 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 May 7, 2025
@openjdk openjdk bot closed this May 7, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels May 7, 2025
@openjdk
Copy link

openjdk bot commented May 7, 2025

@magicus @galderz Pushed as commit 772c970.

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

@galderz
Copy link
Contributor Author

galderz commented May 16, 2025

I do think it's a bug that JMH is bundling its checkstyle and findbugs configurations in its distribution jar, so perhaps we can suggest to a JMH maintainer to stop doing that. :)

I think that makes sense to me and I can try to do that. Both files could be moved to src/test/resources, modify the jmh-core pom.xml to files there instead. The combination of both would stop those xml from ending in the distribution jar.

I've created CODETOOLS-7903998 to track this.

FYI ^ is now fixed in JMH

@galderz galderz deleted the topic.missing-instruments-xml branch December 19, 2025 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build build-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

4 participants