jdk icon indicating copy to clipboard operation
jdk copied to clipboard

8288783: JFR: Error messages are confusing when options conflict in -XX:StartFlightRecording

Open chiroito opened this issue 3 years ago • 11 comments

Could I have a review of PR that fixes incorrect error messages regarding of recording.

The current message is very confusing. If a user types jcmd JFR.start name=abc name=def or java --XX:StartFlightRecording=name=abc,name=def, the error message says "Duplicates in diagnostic command arguments", but doesn't know what options are duplicated. Furthermore, if a user specifies two or three duplicate parameters, the same logs will be output.

It should say follows, Option name can only be specified once with starting flight recording Options name and disk can only be specified once with starting flight recording Options name, disk and maxage can only be specified once with starting flight recording This problem affects --XX:StartFlightRecording, jcmd JFR.start, JFR.stop, JFR.dump, JFR.check, and MBean.

For other than start, the output is as follows, (example of dump) Option name can only be specified once with dumping flight recording

Testing: jdk/jdk/jfr

Thanks Chihiro


Progress

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

Integration blocker

 ⚠️ Title mismatch between PR and JBS for issue JDK-8288783

Issue

  • JDK-8288783: Error messages are confusing when options conflict in -XX:StartFlightRecording ⚠️ Title mismatch between PR and JBS.

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 9302

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

Using diff file

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

chiroito avatar Jun 28 '22 05:06 chiroito

:wave: Welcome back cito! 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.

bridgekeeper[bot] avatar Jun 28 '22 05:06 bridgekeeper[bot]

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

  • build
  • hotspot-jfr

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[bot] avatar Jun 28 '22 05:06 openjdk[bot]

/label -build

magicus avatar Jun 28 '22 09:06 magicus

@magicus The build label was successfully removed.

openjdk[bot] avatar Jun 28 '22 09:06 openjdk[bot]

@chiroito This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

bridgekeeper[bot] avatar Jul 26 '22 10:07 bridgekeeper[bot]

@chiroito This pull request has been inactive for more than 8 weeks and will now be automatically closed. If you would like to continue working on this pull request in the future, feel free to reopen it! This can be done using the /open pull request command.

bridgekeeper[bot] avatar Aug 23 '22 16:08 bridgekeeper[bot]

/open

chiroito avatar Oct 06 '22 07:10 chiroito

@chiroito This pull request is now open

openjdk[bot] avatar Oct 06 '22 07:10 openjdk[bot]

Mailing list message from Chihiro Ito on hotspot-jfr-dev:

Could you review this fix to make the error message more user friendly, please?

Regards, Chihiro

2022?6?28?(?) 15:55 Chihiro Ito <cito at openjdk.org>:

-------------- next part -------------- An HTML attachment was scrubbed... URL: <https://mail.openjdk.org/pipermail/hotspot-jfr-dev/attachments/20221006/5e3769dc/attachment.htm>

mlbridge[bot] avatar Oct 06 '22 13:10 mlbridge[bot]

@egahlin Could you review this again, please?

chiroito avatar Oct 14 '22 01:10 chiroito

What worries me a bit is the testing. It is thorough, but perhaps too thorough?

It might fail due to other reasons than the added logic, or it may become a maintenance burden. For example, the flush-interval option is planned to be removed. Starting 40 JVMs to verify an improved error message seems excessive.

I would put the tests in one file, TestConflictingOptions and use options that are harmless (disk and name), but include "settings" as it should be repeatable, i.e

void testJCmdConflict() {
  var output= JcmdHelper.jcmd("JFR.start name=hello name=greetings");
  output.shouldContain("name can only be specified once")
}

void testStartFlightRecordingConflict() {
 var output = ProcessTools.executeTestJava("-XX:StartFlightRecording:disk=true,disk=false,name=cat,name=dog");
 output.shouldContain("disk and name can only be specified once.")
}

void testSettings() {
 var output = ProcessTools.executeTestJava("-XX:StartFlightRecording:settings=default,settings=profile");
 output.shouldNotContain("settings can only be specified once")
}

This should give 100% line coverage and make sure it works from both command line and jcmd.

egahlin avatar Oct 15 '22 09:10 egahlin

@chiroito This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

bridgekeeper[bot] avatar Nov 12 '22 19:11 bridgekeeper[bot]

@chiroito This pull request has been inactive for more than 8 weeks and will now be automatically closed. If you would like to continue working on this pull request in the future, feel free to reopen it! This can be done using the /open pull request command.

bridgekeeper[bot] avatar Dec 23 '22 08:12 bridgekeeper[bot]

/open

chiroito avatar Feb 03 '23 05:02 chiroito

@chiroito This pull request is now open

openjdk[bot] avatar Feb 03 '23 05:02 openjdk[bot]

@egahlin Thanks for the review.

/integrate

chiroito avatar Feb 09 '23 03:02 chiroito

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

8288783: Error messages are confusing when options conflict in -XX:StartFlightRecording

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 13 new commits pushed to the master branch:

  • 70f3150166a758fe9fa14860588218ef41c2bff4: 8301443: Clean broken comments from Windows code
  • 5561c397c53b8a821a200491abd8f7b3297fbd31: 8294484: MetalBorder's FrameBorder & DialogBorder have border rendering issues when scaled
  • c8cc7b67dbb4633e365a5d6e44419775ebce9d4a: 8301704: Shorten the number of GCs in UnloadingTest.java to verify a class loader not being unloaded
  • dc6d52cea54eb8c8793dd0f46002c28ec43d9d2c: 8301876: Crash in DumpTimeClassInfo::add_verification_constraint
  • 873558ee80d741469ade030c732091bead431c46: 8300914: Allow @ as an escape in documentation comments
  • 8a9e383dba58ed047ca46007b5af186aade05b59: 8301717: Remove obsolete jib profiles
  • 631a2790e5d5b3eac5102dbc42e57feb94bfc23d: 8301567: The test/jdk/java/awt/AppContext/ApplicationThreadsStop/java.policy is unused
  • 638d612c6b7c08c1f7be0d4e75e9f8a6dca1ef19: 8298478: (fs) Path.of should allow input to include long path prefix
  • 10dd98d0dd6aeb6f214999590ed19707a203f591: 8301462: Convert Permission files to use lambda after JDK-8076596
  • 8d4c76ddce6455e8cf9258ea175bb9f98227c954: 8302072: Parallel: Remove unimplemented ParCompactionManager::stack_push
  • ... and 3 more: https://git.openjdk.org/jdk/compare/c92a7deba50cbf5e283d1bd0ef5f2d6f8a4fc947...master

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[bot] avatar Feb 09 '23 03:02 openjdk[bot]

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

  • 70f3150166a758fe9fa14860588218ef41c2bff4: 8301443: Clean broken comments from Windows code
  • 5561c397c53b8a821a200491abd8f7b3297fbd31: 8294484: MetalBorder's FrameBorder & DialogBorder have border rendering issues when scaled
  • c8cc7b67dbb4633e365a5d6e44419775ebce9d4a: 8301704: Shorten the number of GCs in UnloadingTest.java to verify a class loader not being unloaded
  • dc6d52cea54eb8c8793dd0f46002c28ec43d9d2c: 8301876: Crash in DumpTimeClassInfo::add_verification_constraint
  • 873558ee80d741469ade030c732091bead431c46: 8300914: Allow @ as an escape in documentation comments
  • 8a9e383dba58ed047ca46007b5af186aade05b59: 8301717: Remove obsolete jib profiles
  • 631a2790e5d5b3eac5102dbc42e57feb94bfc23d: 8301567: The test/jdk/java/awt/AppContext/ApplicationThreadsStop/java.policy is unused
  • 638d612c6b7c08c1f7be0d4e75e9f8a6dca1ef19: 8298478: (fs) Path.of should allow input to include long path prefix
  • 10dd98d0dd6aeb6f214999590ed19707a203f591: 8301462: Convert Permission files to use lambda after JDK-8076596
  • 8d4c76ddce6455e8cf9258ea175bb9f98227c954: 8302072: Parallel: Remove unimplemented ParCompactionManager::stack_push
  • ... and 3 more: https://git.openjdk.org/jdk/compare/c92a7deba50cbf5e283d1bd0ef5f2d6f8a4fc947...master

Your commit was automatically rebased without conflicts.

openjdk[bot] avatar Feb 09 '23 03:02 openjdk[bot]

@chiroito Pushed as commit 36478ee13f0877447852470150c01397388b3f82.

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

openjdk[bot] avatar Feb 09 '23 03:02 openjdk[bot]