RFR: 8353727: HeapDumpPath doesn't expand %p

Kevin Walls kevinw at openjdk.org
Tue Apr 8 09:02:13 UTC 2025


On Tue, 8 Apr 2025 01:37:21 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:

>> This is a long-standing oversight: HeapDumpPath does not recognise %p for pid expansion.
>> The default filename uses a pid (e.g. java_pid1676937.hprof) but HeapDumpPath does not.
>> It has always done a manual "root plus pid plus extension" on the default filename only, and
>> should move to using Argument::copy_expand_pid() like we do with other such filenames.
>> 
>> 
>> We also assumed the default filename is not a directory (which is very very likely, but doesn't have to be true).
>
> src/hotspot/share/services/heapDumper.cpp line 2792:
> 
>> 2790:       // Path is a directory.  Append the default name, with %p substitution.  Use my_path temporarily.
>> 2791:       if (!Arguments::copy_expand_pid(dump_file_name, strlen(dump_file_name), my_path, JVM_MAXPATHLEN)) {
>> 2792:         warning("Cannot create heap dump file.  HeapDumpPath is too long.");
> 
> What is going to be the end result of this? A truncated file name?

Yes the other warnings return - thanks.
They all return without incrementing dump_seq, so will hit the same failure each time.
Setting a HeapDumpPath near to 4k in length is not an efficient thing to do!

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24482#discussion_r2032733570


More information about the hotspot-runtime-dev mailing list