RFR: 8359472: JVM crashes when attaching a dynamic agent before JVMTI_PHASE_LIVE [v2]
Serguei Spitsyn
sspitsyn at openjdk.org
Thu Oct 16 22:37:04 UTC 2025
On Tue, 14 Oct 2025 21:34:42 GMT, Leonid Mesnik <lmesnik at openjdk.org> wrote:
>> Francesco Andreuzzi has updated the pull request incrementally with one additional commit since the last revision:
>>
>> summary
>
> 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.
Also, I'd suggest to convert native part from C to C++. Some examples in the test base can be found easily. There is already a number of tests with C based native agents. We need to convert them to C++ at some point.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27766#discussion_r2437610532
More information about the serviceability-dev
mailing list