RFR: 8359472: JVM crashes when attaching a dynamic agent before JVMTI_PHASE_LIVE [v13]
Serguei Spitsyn
sspitsyn at openjdk.org
Tue Oct 21 07:14:07 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/libEarlyDynamicLoad.cpp line 47:
> 45:
> 46: jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks));
> 47: jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, nullptr);
Nit: Even though it is normally works well it'd be better to check and handle the `jvmtiError` code returned from the JVMTI functions. You can easily find some examples to follow. Also, the indent for native code has to be 2, not 4. It is possible, you can find some tests where this kind of check/handling is missed or the indent is incorrect. It does not mean we should have these bad habits with new tests. :)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27766#discussion_r2446956647
More information about the serviceability-dev
mailing list