Skip to content

Skip emission of internal JFR ThreadPark events #11769

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

roberttoyonaga
Copy link
Collaborator

@roberttoyonaga roberttoyonaga commented Jul 23, 2025

When synchronization such as monitor enter or wait is used, Unsafe.park is used under-the-hood to block threads. This results in not only jdk.JavaMonitorWait and jdk.JavaMonitorEnter events being emitted, but secondary jdk.ThreadPark events being emitted as well. The jdk.ThreadPark events are only emitted due to the implementation details of the com.oracle.svm.core.monitor.JavaMonitor and com.oracle.svm.core.monitor.JavaMonitorQueuedSynchronizer classes.

In Hotspot, the Java Unsafe class is not needed to block threads so jdk.JavaMonitorWait and jdk.JavaMonitorEnter events are emitted without corresponding jdk.ThreadPark events.

We should reduce noise and copy Hotspot by skipping the emission of these internal jdk.ThreadPark events.

Hotspot
image
image
Notice that there is no jdk.ThreadPark corresponding to the jdk.JavaMonitorEnter event.

Native Image before the fix
image
image
Notice that there is a jdk.ThreadPark corresponding to the jdk.JavaMonitorEnter event

Native Image after the fix
image
image

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jul 23, 2025
@roberttoyonaga roberttoyonaga added native-image redhat-interest native-image-jfr and removed OCA Verified All contributors have signed the Oracle Contributor Agreement. labels Jul 23, 2025
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jul 23, 2025
@roberttoyonaga roberttoyonaga marked this pull request as ready for review July 23, 2025 21:26
@roberttoyonaga
Copy link
Collaborator Author

@christianhaeubl Can you please have a look at this when you have time?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
native-image native-image-jfr OCA Verified All contributors have signed the Oracle Contributor Agreement. redhat-interest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant