RFR: 8298526: The detection state allows records in the stopped state to be closed when JFR.stop [v3]
Erik Gahlin
egahlin at openjdk.org
Sun Dec 11 13:49:57 UTC 2022
On Sun, 11 Dec 2022 08:53:13 GMT, xpbob <duke at openjdk.org> wrote:
>> start jfr with duration
>>
>> jcmd 31514 JFR.start duration=30s
>> 31514:
>> Started recording 1.
>>
>> Use jcmd 31514 JFR.stop name=1 filename=FILEPATH to copy recording data to file.
>>
>>
>>
>> use JFR.check after 30s
>>
>> jcmd 31514 JFR.check
>> 31514:
>> Recording 1: name=1 duration=30s (stopped)
>>
>>
>> Unable to close the stopped jfr
>>
>> jcmd 31514 JFR.stop name=1
>> 31514:
>> Can't stop an already stopped recording.
>> ```
>>
>> The detection state allows records in the stopped state to be closed when JFR.stop
>
> xpbob has updated the pull request incrementally with one additional commit since the last revision:
>
> use stop cmd to check
The reason this happens is because no filename was specified when using a duration. Without a filename, JFR could not dump the recording, so it decided to keep the data.
The error message is correct, but I understand what you want to achieve. There should be a away to remove/close a stopped recording. I'm not sure JFR.stop is the best way. Perhaps it is, but I can think of other ways as well:
1. Require the user to specify filename when using duration (could potentially break scripts, but perhaps fine)
2. Generate a filename when using a duration without a filename
3. Close the recording after a JFR.dump
4. Introduce JFR.close command
5. Close the recording when duration has happened, even if data was not dumped
More?
-------------
PR: https://git.openjdk.org/jdk/pull/11625
More information about the hotspot-jfr-dev
mailing list