There are a number of comments in the debug agent that read "TODO - vthread node cleanup". These are the likely best locations for freeing up the nodes.
Another approach, which hasn't been thought through too much, is to have some sort of periodic task walk the list of vthread ThreadNodes, and free up those that are no longer needed. ThreadNodes don't escape the code in threadControl.c, and it looks like whenever somehow holds a reference to a ThreadNode, the threadLock is held. So this might make it safe to purge ThreadNodes while holding the threadLock.
One other thing to note is that if enumeratevthreads=y is passed to the debug agent, then it needs to keep track of all vthreads, which means keep around a vthread ThreadNodes, so there should be no purging done in this case.
- causes
-
JDK-8372809 Test vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended001/TestDescription.java failed: JVMTI_ERROR_THREAD_NOT_ALIVE
-
- Resolved
-
- relates to
-
JDK-8372957 After JDK-8282441 JDWP might allow some invalid FrameIDs to be used
-
- Resolved
-
-
JDK-8371380 [LOOM] The debug agent should avoid enabling VIRTUAL_THREAD_START/END events when possible
-
- In Progress
-
-
JDK-8353955 nsk/jdi tests should be fixed to not always require includevirtualthreads=y
-
- Resolved
-
-
JDK-8353953 com/sun/jdi tests should be fixed to not always require includevirtualthreads=y
-
- Resolved
-
- links to
-
Commit(master)
openjdk/jdk/2b5cd14e
-
Review(master)
openjdk/jdk/28211