RFR: JDK-8190187: C++ code calling JNI_CreateJavaVM can be killed by Java

Adam Farley8 adam.farley at uk.ibm.com
Wed Dec 6 11:53:39 UTC 2017

Hi All,

We have a bug in OpenJDK where if you pass an info-only option (like 
-agentlib:jdwp=help) in through the JNI interface, it can exit your code 
with RC 0.

I think this is a bug because if you planned to do anything after starting 
a Java VM, you have to do it in an exit hook.

If an info-only option is used, exit(0) should not happen. Instead, the 
user's code should be told the VM cannot be used.

Bug Link: https://bugs.openjdk.java.net/browse/JDK-8190187

I have proposed the creation of a new JNI return code indicating a "silent 
exit", where the vm encountered no error, but that it is not in a fit 
state to be used.

See the link for an implementation of this, along with a handy test.

In short, if you agree that this is a problem, we need a champion to:

1) Complete the CSR process for the new JNI Return code.
2) Commit the changes that contain (a) the new return code, and (b) the 
non-Hotspot code that handles the new code.

Optionally, if you want to commit the code containing an example of the 
fix, you will need to:

3) Commit the Hotspot code that channels the new return code.
4) Complete the CSR process for the jdwp behaviour change.
5) Commit the jdwp code.

Note that all of this code has *already been written*. This should be an 
easy commit once the CSR is done with.

Best Regards

Adam Farley

Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU

More information about the hotspot-runtime-dev mailing list