RFR: JDK-8327769: jcmd GC.heap_dump without options should write to location given by -XX:HeapDumpPath, if set [v10]

Christoph Langer clanger at openjdk.org
Wed Apr 3 13:41:14 UTC 2024


On Wed, 27 Mar 2024 13:44:42 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

>> Currently jcmd command GC.heap_dump only works with an additionally provided file name.
>> Syntax : GC.heap_dump [options] <filename>
>> 
>> In case the JVM has the XX - flag HeapDumpPath set, we should support an additional mode where the <filename> is optional.
>> In case the filename is NOT set, we take the HeapDumpPath (file or directory);
>> 
>> new syntax :
>> GC.heap_dump [options] <filename> .. has precedence over second option
>> GC.heap_dump [options] …in case -XX: HeapDumpPath=p is set
>> 
>> This would be a simplification e.g. for support cases where a filename or directory is set at JVM startup with -XX: HeapDumpPath=p and writing to the path is intended/recommended for usage also in the jcmd case.
>
> Matthias Baesken has updated the pull request incrementally with one additional commit since the last revision:
> 
>   adjust java.1 man page

Couldn't we just have an unconditional default for the GC.heap_dump `filename` option? This would simplify the documentation. E.g. we could write `If not specified, defaults to java_pid<pid>.hprof in the working directory or value configured through -XX:HeapDumpPath`

As for the general value of this feature, I think it can simplify the handling of certain (cloud) deployment configurations where you have a dedicated filesystem that you want to write these kind of dumps to. It might also be nice if there was a default value for filename instead of the obligation to specify something. And, for those who can't see the upside of it all, I at least can't see no harm...

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

PR Comment: https://git.openjdk.org/jdk/pull/18190#issuecomment-2034639628


More information about the serviceability-dev mailing list