RFR: 8320652: ThreadInfo.isInNative needs to be updated to say what executing native code means [v2]

Alan Bateman alanb at openjdk.org
Thu Nov 30 09:29:11 UTC 2023


On Wed, 29 Nov 2023 10:49:12 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>>> seems to be no java method marked "native" on the stack, what case is that?
>> 
>> A native thread that is attached to the VM but is not currently executing any Java code.
>> 
>>> funfact: its not in the list
>> 
>> JDWP filters its own internal threads out of any thread lists it returns, so this may be a case of using two different API's with different views of the set of threads running.
>
>> JDWP filters its own internal threads out of any thread lists it returns, so this may be a case of using two different API's with different views of the set of threads running.
> 
> I think the issue that Bernd is running into is a long standing anomaly between ThreadMXBean.getAllThreadIds() and the ThreadMXBean.getThreadInfo methods. The former uses a ThreadsListEnumerator with include_jvmti_agent_threads=false so it filters out the JVMTI agent threads. The latter doesn't do the filtering so if you have threadId of a JVMTI agent thread then you can get its thread info.

I've created [JDK-8321095](https://bugs.openjdk.org/browse/JDK-8321095) to track the inconsistency that Bernd  brought up on whether JVMTI agent threads are hidden or not by ThreadMXBean.  It seems this inconsistency goes back a long way, to JDK 8 at least.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16791#discussion_r1410388266


More information about the serviceability-dev mailing list