RFR: 8309397: com/sun/jdi/JdbXXX tests fail due to not being run with -Djdk.trackAllThreads
Chris Plummer
cjplummer at openjdk.org
Sat Jun 3 19:02:04 UTC 2023
On Sat, 3 Jun 2023 07:09:54 GMT, Alan Bateman <alanb at openjdk.org> wrote:
> Would it be possible to expand a bit on why jdk.trackAllThreads is needed? I would have expected jdb "threads" command to be sensitive to whether the debuggee is launched with the JDWP includevirtualthreads option but jdk.trackAllThreads isn't used by the JDWP agent, it is instead used to determine if virtual threads created directly with the Thread API show up in thread dumps or not.
I think you are right that this change should not be needed. I was working on addressing a number of different issues with launching debuggees properly and the tests being able to discover virtual threads, and I think maybe I had done this "fix" at some point, and then did [JDK-8309334](https://bugs.openjdk.org/browse/JDK-8309334), (and [JDK-8309396](https://bugs.openjdk.org/browse/JDK-8309396)), and thought that this fix was still needed. I thought for sure it was helping, but I've removed it and the tests still seem to pass with just JDK-8309334 and JDK-8309396.
jdb by default does not track all virtual threads. It does have a a `-trackallthreads` command line option, which triggers passing `includevirtualthreads=y` to the debug agent (assuming jdb is actually doing the launching and not just attaching). However, given that these tests do not pass `includevirtualthreads=y`, I didn't find myself wondering how they were passing after just fixing [JDK-8309334](https://bugs.openjdk.org/browse/JDK-8309334). The answer is that jdb does track any virtual thread that it gets an event for, so as it turns out when these 4 jdb tests look for a specific thread in the `threads` output, it's always a thread that jdb already learned about via an event. I might do a separate PR just to force either `-trackallthreads` or `includevirtualthreads=y`, but currently that doesn't seem to be needed by any of the jdb tests.
So I think I should close this PR and update the [JDK-8309334](https://bugs.openjdk.org/browse/JDK-8309334) PR to remove the 3 tests that seem to pass with it and don't also need this PR to pass. The 4th test `com/sun/jdi/JdbMethodExitTest.java` needs an additional fix that I need to push separately.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/14293#issuecomment-1575129126
More information about the serviceability-dev
mailing list