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

Serguei Spitsyn sspitsyn at openjdk.org
Tue Oct 21 22:53:49 UTC 2025


On Tue, 21 Oct 2025 09:47:52 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:
> 
>   cc

The fix is good. I've posted a couple of nits though.

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

> 45:  * @run junit TestEarlyDynamicLoad
> 46:  */
> 47: public class TestEarlyDynamicLoad {

Nit: It is convenient if the test folder name matches the test class name. There are several cases where this is broken in our testbase. But it is still a good idea to keep this invariant where possible.

test/hotspot/jtreg/serviceability/attach/EarlyDynamicLoad/libEarlyDynamicLoad.cpp line 54:

> 52:     fprintf(stderr, "JVMTI error occurred during SetEventNotificationMode\n");
> 53:     return 1;
> 54:   }

Nit: The returned values have to be JNI_ERR or JNI_OK.

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

Marked as reviewed by sspitsyn (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/27766#pullrequestreview-3362992561
PR Review Comment: https://git.openjdk.org/jdk/pull/27766#discussion_r2449910819
PR Review Comment: https://git.openjdk.org/jdk/pull/27766#discussion_r2449902636


More information about the serviceability-dev mailing list