RFR: 8359472: JVM crashes when attaching a dynamic agent before JVMTI_PHASE_LIVE [v13]

Alex Menkov amenkov at openjdk.org
Mon Oct 20 21:06:08 UTC 2025


On Fri, 17 Oct 2025 20:16:28 GMT, Francesco Andreuzzi <fandreuzzi at openjdk.org> wrote:

>> In this PR I add a check to prevent debug builds to crash when an agent tries to attach while the JVM is not in live phase.
>> 
>> Passes tier1 and tier2 (fastdebug).
>
> Francesco Andreuzzi has updated the pull request incrementally with one additional commit since the last revision:
> 
>   fix tool call

test/hotspot/jtreg/serviceability/attach/EarlyDynamicLoad/TestEarlyDynamicLoad.java line 35:

> 33: import java.io.InputStream;
> 34: import java.util.Objects;
> 35: import java.util.concurrent.TimeUnit;

Unused imports

test/hotspot/jtreg/serviceability/attach/EarlyDynamicLoad/TestEarlyDynamicLoad.java line 99:

> 97: 
> 98:         ProcessBuilder pb = new ProcessBuilder(jcmd.getCommand());
> 99:         OutputAnalyzer out = new OutputAnalyzer(pb.start());

I'd suggest to use `jdk.test.lib.dcmd.PidJcmdExecutor`
Then this can be simplified to something like


OutputAnalyzer out = new PidJcmdExecutor().execute("JVMTI.agent_load some.jar");

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27766#discussion_r2446116204
PR Review Comment: https://git.openjdk.org/jdk/pull/27766#discussion_r2446119986


More information about the serviceability-dev mailing list