Question about JEP 509 and thread state

Erik Gahlin erik.gahlin at oracle.com
Wed Jul 23 12:11:39 UTC 2025


Hello,

The ExecutionSample event will only sample code that is running Java code. The NativeMethodSample event will sample both running and blocked code in native code. See the descriptions of the events:

https://github.com/openjdk/jdk/blob/e6ac956a7ac613b916c0dbfda7e57856c1b8a83c/src/hotspot/share/jfr/metadata/metadata.xml#L951

The JEP text is confusing, and we are working on an improved version.

Erik

________________________________
From: hotspot-jfr-dev <hotspot-jfr-dev-retn at openjdk.org> on behalf of Milan Mimica <milan.mimica at gmail.com>
Sent: Wednesday, July 23, 2025 9:41 AM
To: hotspot-jfr-dev at openjdk.org <hotspot-jfr-dev at openjdk.org>
Subject: Question about JEP 509 and thread state

Hello

I have always assumed that JFR thread sampler will ignore threads that are blocked on socket read, but the description on https://openjdk.org/jeps/509 states that this is exactly the problem that the JEP 509 aims to resolve.

So my question is specifically about JfrSamplerThread::sample_java_thread/sample_native_thread. These explicitly skip sampling unless the thread state is _thread_in_Java/ _thread_in_native. Which state is a thread in while blocked on socket read? I assumed it was _thread_blocked.


--
Milan Mimica

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/hotspot-jfr-dev/attachments/20250723/1e3cd9a8/attachment.htm>


More information about the hotspot-jfr-dev mailing list