JDK-8247248 : JVM TI Monitor queries might create JNI locals in another thread when using handshakes.
  • Type: Bug
  • Component: hotspot
  • Sub-Component: jvmti
  • Affected Version: 15
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-06-09
  • Updated: 2024-10-17
  • Resolved: 2020-06-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 15 JDK 16
15 b27Fixed 16Fixed
Related Reports
Relates :  
Description
JDK-8242425 introduced the use of direct handshakes for the Monitor query functions in JVM TI. If the direct handshake is executed by the target thread, the JNI local(s) are created in that thread but returned in the handshaking thread.
They thus are not safe to use.
Comments
Changeset: 6a2e3ca2 Author: Robbin Ehn <rehn@openjdk.org> Date: 2020-06-11 10:00:23 +0000 URL: https://git.openjdk.java.net/lanai/commit/6a2e3ca2
02-07-2020

URL: https://hg.openjdk.java.net/jdk/jdk/rev/88e8326cb71a User: rehn Date: 2020-06-11 08:21:03 +0000
11-06-2020

Untested v2: http://cr.openjdk.java.net/~rehn/8247248/v2/webrev/
10-06-2020

> How was this done when using a safepoint VMOperation? The VMThread used the JNIEnv* of the calling thread. I'm concerned that using global references here is going to be quite expensive. I wonder if this is a case where we should be able to say that the handshake operation must not happen in the target thread? Or can we perhaps use the calling thread's JVMTIEnv* as the VMThread used to do?
10-06-2020

Exactly the kind of problem I was concerned about when we start running the handshake operations in different threads! How was this done when using a safepoint VMOperation?
09-06-2020

http://cr.openjdk.java.net/~rehn/8247248/v1/webrev/
09-06-2020