RFR: 8212825: jfr.dcmd log is not shown

Yasumasa Suenaga yasuenag at gmail.com
Tue Oct 23 15:32:43 UTC 2018


Hi Erik,

I filed this issue as JDK-8212825, and I uploaded webrev.
Could you review it?

   http://cr.openjdk.java.net/~ysuenaga/JDK-8212825/webrev.00/


Thanks,

Yasumasa


On 2018/10/24 0:17, Erik Gahlin wrote:
> Hi Yasumasa,
> 
> Please file a bug. Markus and I will not have time to look at this week (CodeOne), but I will check it out next week. Ping me if I forget.
> 
> Thanks
> Erik
> 
> 
>> On 23 Oct 2018, at 08:10, Yasumasa Suenaga <yasuenag at gmail.com> wrote:
>>
>> Hi all,
>>
>> I tried to check arguments of -XX:StartFlightRecording via -Xlog:jfr+dcmd=debug , but I couldn't.
>>
>> jfr.dcmd log will be shown from DCmdStart::execute, but I think it has two problems:
>>
>>   1. Log level will be not set before showing log.
>>      LogTag::tagSetLevel is used to decide to show the log. But it will be set in
>>      JNI code which is called by JVM::<clinit>. JVM class is not loaded when
>>      DCmdStart::execute tries to show log.
>>
>>   2. `settings` might be null, so NPE will occur when DCmdStart::execute tries to
>>      show log.
>>
>> IMHO they can be fixed with following patch. Can I file this problem to JBS and send a webrev?
>> (I'm a Committer of jdk project)
>>
>>
>> ---------------------
>> diff -r eadd0abbfdf4 src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdStart.java
>> --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdStart.java    Tue Oct 23 13:24:36 2018 +0200
>> +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdStart.java    Wed Oct 24 00:10:05 2018 +0900
>> @@ -34,6 +34,7 @@
>> import java.util.Arrays;
>> import java.util.HashMap;
>> import java.util.Map;
>> +import java.util.Objects;
>>
>> import jdk.jfr.FlightRecorder;
>> import jdk.jfr.Recording;
>> @@ -81,9 +82,12 @@
>>       */
>>      @SuppressWarnings("resource")
>>      public String execute(String name, String[] settings, Long delay, Long duration, Boolean disk, String path, Long maxAge, Long maxSize, Boolean dumpOnExit, Boolean pathToGcRoots) throws DCmdException {
>> +        if (!JVM.getJVM().isAvailable()) {
>> +            throw new DCmdException("JFR is not available");
>> +        }
>>          if (LogTag.JFR_DCMD.shouldLog(LogLevel.DEBUG)) {
>>              Logger.log(LogTag.JFR_DCMD, LogLevel.DEBUG, "Executing DCmdStart: name=" + name +
>> -                    ", settings=" + Arrays.asList(settings) +
>> +                    ", settings=" + Arrays.asList(Objects.requireNonNullElse(settings, new String[0])) +
>>                      ", delay=" + delay +
>>                      ", duration=" + duration +
>>                      ", disk=" + disk+
>> ---------------------
>>
>>
>> Thanks,
>>
>> Yasumasa
> 


More information about the hotspot-jfr-dev mailing list