RFR: 8288783: JFR: Error messages are confusing when options conflict in -XX:StartFlightRecording [v3]

Andrey Turbanov aturbanov at openjdk.org
Sat Oct 15 07:55:54 UTC 2022


On Thu, 13 Oct 2022 06:07:49 GMT, Chihiro Ito <cito at openjdk.org> wrote:

>> 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 <pid> 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
>
> Chihiro Ito has updated the pull request incrementally with one additional commit since the last revision:
> 
>   reverting file headers

src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/ArgumentParser.java line 126:

> 124:                 } else {
> 125:                     if (options.containsKey(key)) {
> 126:                         if(!conflictedOptions.contains(key)) {

Suggestion:

                        if (!conflictedOptions.contains(key)) {

test/jdk/jdk/jfr/jcmd/TestJcmdOptionSpecifiedOnce.java line 123:

> 121:         try {
> 122:             Matcher matcher = Pattern.compile(regex).matcher(output);
> 123:             if(matcher.find()){

Suggestion:

            if (matcher.find()){

test/jdk/jdk/jfr/startupargs/TestStartupOptionSpecifiedOnce.java line 101:

> 99:         try {
> 100:             Matcher matcher = Pattern.compile(regex).matcher(output);
> 101:             if(matcher.find()){

Suggestion:

            if (matcher.find()){

-------------

PR: https://git.openjdk.org/jdk/pull/9302


More information about the hotspot-jfr-dev mailing list