Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JMC-6141: JMC logs warnings when creating recordings #270

Closed
wants to merge 1 commit into from

Conversation

aptmac
Copy link
Member

@aptmac aptmac commented Jun 23, 2021

This PR addresses JMC-6141 [0], in which JMC logs warnings when creating recordings. This is particularly annoying when running unit tests because the terminal gets flooded with warnings.

There are two problems here.

The first problem is that the JFR_SETTINGS_PERIOD constant in EventTypeMetadataV2 is outdated. It is currently hardcoded as com.oracle.jfr.settings.Period which looks to have been the name prior to open-sourcing [1], but has since become jdk.settings.Period [2][3]. This removes the warnings related to WARNING: Inferred content type 'jdk.jfr.Period' for option Period.

The second problem is that there isn't any handling for the value "infinity" when parsing the timespan. The method parsePersisted() in LinearKindOfQuantity looks at the persisted string and uses regex to separate the unit from the value. In this case with period however, if the timespan is infinite then the string is just "infinity", so the regex doesn't work and we end up throwing an exception. I took some inspiration from the jfr code [4], and it handles infinite timespans by checking the string, and if it is "infinity" then returns the max long value [5]. I've added a unit test to reinforce this behaviour.

Let me know if this approach is okay, and if there are different options I need to consider.

After these two changes my test output is legible, and I haven't noticed and regressions with uitests or my manual testing. When doing a regular mvn clean verify for the application we see a reduction of 12800 logged lines.

[0] https://bugs.openjdk.java.net/browse/JMC-6141
[1] https://github.com/alibaba/dragonwell8_jdk/blob/423386885af50cf6f956d1b1ba159a994045a8ae/src/share/classes/jdk/jfr/internal/settings/PeriodSetting.java/#L43
[2] https://github.com/openjdk/jdk/blob/master/src/jdk.jfr/share/classes/jdk/jfr/internal/settings/PeriodSetting.java#L42
[3] https://github.com/openjdk/jdk/blob/master/src/jdk.jfr/share/classes/jdk/jfr/internal/Type.java#L53
[4] https://github.com/openjdk/jdk/blob/master/src/jdk.jfr/share/classes/jdk/jfr/internal/settings/PeriodSetting.java#L116
[5] https://github.com/openjdk/jdk/blob/master/src/jdk.jfr/share/classes/jdk/jfr/internal/Utils.java#L304


Progress

  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JMC-6141: JMC logs warnings when creating recordings

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jmc pull/270/head:pull/270
$ git checkout pull/270

Update a local copy of the PR:
$ git checkout pull/270
$ git pull https://git.openjdk.java.net/jmc pull/270/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 270

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jmc/pull/270.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 23, 2021

👋 Welcome back aptmac! 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 openjdk bot added the rfr label Jun 23, 2021
@mlbridge
Copy link

mlbridge bot commented Jun 23, 2021

Webrevs

@jpbempel
Copy link
Member

I've added a unit test to reinforce this behaviour.

I don't see it in the PR, have you forget to add it?

@aptmac
Copy link
Member Author

aptmac commented Jun 25, 2021

I've added a unit test to reinforce this behaviour.

I don't see it in the PR, have you forget to add it?

Ah yes I had forgotten to push it, it should be included now.

@openjdk
Copy link

openjdk bot commented Jun 25, 2021

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

6141: JMC logs warnings when creating recordings

Reviewed-by: hirt, jpbempel

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 no new commits pushed to the master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential 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 added the ready label Jun 25, 2021
@aptmac
Copy link
Member Author

aptmac commented Jun 25, 2021

/integrate

@openjdk
Copy link

openjdk bot commented Jun 25, 2021

Going to push as commit e34323d.

@openjdk openjdk bot closed this Jun 25, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Jun 25, 2021
@openjdk
Copy link

openjdk bot commented Jun 25, 2021

@aptmac Pushed as commit e34323d.

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

@aptmac aptmac deleted the 6141 branch June 25, 2021 19:56
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