JDK-8342970 : JNI_GetCreatedJavaVMs returns a partially initialized JVM
  • Type: CSR
  • Component: hotspot
  • Sub-Component: runtime
  • Priority: P3
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 17-pool
  • Submitted: 2024-10-24
  • Updated: 2024-10-28
  • Resolved: 2024-10-28
Related Reports
CSR :  
Relates :  
Description
Summary
-------

`JNI_GetCreatedJavaVMs` will now only return a VM that has been successfully initialized.

Problem
-------

`JNI_GetCreatedJavaVMs` will currently return a VM that has only just started to be created by `JNI_CreateJavaVM`. Consequently, if code then tries to attach to that VM it can crash in various ways, as the VM may not yet be ready for attaching.

Solution
--------

`JNI_GetCreatedJavaVMs` will now only return a VM that has been successfully initialized.

Specification
-------------

There are no changes to the JNI specification. The specification for `JNI_GetCreatedJavaVMs` already states:

> Returns all Java VMs that have been created.

and it is reasonable to expect that "created" means fully created, not "in the process of being created".

Comments
Moving to Approved.
28-10-2024

Moving to Provisional, not Approved. [~dholmes], please review this backport CSR.
25-10-2024