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). ------------- Commit messages: - 8353727: HeapDumpPath doesn't expand %p Changes: https://git.openjdk.org/jdk/pull/24482/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24482&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8353727 Stats: 73 lines in 2 files changed: 26 ins; 23 del; 24 mod Patch: https://git.openjdk.org/jdk/pull/24482.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/24482/head:pull/24482 PR: https://git.openjdk.org/jdk/pull/24482