JDK-8214294 : Control sending of JVMTI events with a new Thread::can_post_jvmti_events() property
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: jvmti
  • Affected Version: 12
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2018-11-26
  • Updated: 2024-07-15
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 25
25Unresolved
Related Reports
Relates :  
Description
While discussing solutions for "8213834: JVMTI ResourceExhausted should not be posted in CompilerThread" (see [1]) a more general way to express the ability of a Thread to be able to send JVMTI events was proposed.

a new "virtual bool Thread::can_post_JVMTI_events();" property could, similar to can_call_java(), suppress all kinds of JVMTI events from certain threads.

Open  questions:

Which events? For a few JVMTI events the JVMTI documentation already restricts handlers to "not use JNI functions and must not use JVM TI functions except those which specifically allow such use" (see e.g. ObjectFree at [2]). Should we take this into account and not suppress these events?

Which Threads? Does the ability to send JVMTI events from threads have to be documented in the JVMTI spec? If yes, that needs to be done before this RFE is implemented.

[1] http://mail.openjdk.java.net/pipermail/serviceability-dev/2018-November/025911.html
[2] https://docs.oracle.com/javase/8/docs/platform/jvmti/jvmti.html#ObjectFree

Comments
I think there are different restrictions that might apply to a handler, compared to the thread posting the event. But if a handler can know what thread is executing it then it could deal with problems if there are restrictions on the handler. But this is not clear cut.
26-11-2018