RFR: 8309171: Test vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/TestDescription.java fails after JDK-8308341

Alan Bateman alanb at openjdk.org
Wed May 31 17:47:55 UTC 2023


On Wed, 31 May 2023 06:41:26 GMT, David Holmes <dholmes at openjdk.org> wrote:

> The fix for [JDK-8308341](https://bugs.openjdk.org/browse/JDK-8308341) overlooked the fact that during VM initialization agents can run and create native threads that will attach to (and potentially detach from) the VM. The check that VM init was complete before allowing those operations was too strong and has to be reverted. All the guards, except for that of GetCreatedJavaVMs itself, is reverted to the way it was before JDK-8308341.
> 
> Testing: tiers 1-4 (in progress)
> 
> Thanks.

I skimmed through the JVMTI spec and I don't see anything to set expectations that a thread can potentially JNI attach before the "live phase".  However, once the VM is in the live phase and the VMInit callback is invoked then it's game on. This makes me wonder if VM_Creation_State needs an additional state between IN_PROGRESS and CREATED to indicate that the VM is initialized so  IN_PROGRESS -> "new-state"  in Threads::create_vm and before JvmtiExport::post_vm_initialized, and "nw-state" -> CREATED when Threads::create_vm completes. That would prevent JNI attach before entering the live phase.

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

PR Comment: https://git.openjdk.org/jdk/pull/14239#issuecomment-1570652742


More information about the hotspot-dev mailing list