RFR: 8359472: JVM crashes when attaching a dynamic agent before JVMTI_PHASE_LIVE [v2]
Leonid Mesnik
lmesnik at openjdk.org
Thu Oct 16 14:46:19 UTC 2025
On Tue, 14 Oct 2025 08:17:19 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:
>
> summary
test/hotspot/jtreg/serviceability/EarlyDynamicLoad/TestEarlyDynamicLoadAttach.java line 40:
> 38: import jdk.test.lib.JDKToolFinder;
> 39:
> 40: public class TestEarlyDynamicLoadAttach {
We don't usually have individual tests on the 'serviceability' level.
Please move test into 'attach' folder. It is test for fix in the attach mechanism.
test/hotspot/jtreg/serviceability/EarlyDynamicLoad/libEarlyDynamicLoad.c line 38:
> 36: static void JNICALL VMStartJcmd(jvmtiEnv* jvmti, JNIEnv* env) {
> 37: char cmd[256];
> 38: snprintf(cmd, sizeof(cmd), "%s %d JVMTI.agent_load some.jar", getenv("JCMD_PATH"), PID());
Wouldn't be easier to have single env variable like ATTACH_CMD `.../bin/jcmd 45678 JVMTI.agent_load some.jar` which is completely set by java? So native code is simplified and there are less dependencies.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27766#discussion_r2430534383
PR Review Comment: https://git.openjdk.org/jdk/pull/27766#discussion_r2430539286
More information about the serviceability-dev
mailing list