RFR: 8309506: com/sun/jdi/MultiBreakpointsTest.java fails with virtual test thread factory

Chris Plummer cjplummer at openjdk.org
Mon Jun 5 22:20:56 UTC 2023


The test fails when the main debuggee thread is a virtual thread, because virtual threads are always daemon threads. Because of this all the test threads that the debuggee creates are also daemon threads. The main deuggee thread immediately exits after creating the test threads, and at that point there are no non-daemon threads left running to keep the debuggee process alive, so the test threads never get a chance to do all the work that is expected of them. 

The fix is to use Thread.join() to prevent the main test thread from exiting until all the created tests threads have exited. I also updated the test so when run using the virtual test thread factory, the debuggee test threads will now be virtual threads. Previously just the main debuggee thread would be a virtual thread. This is not a bug fix, but does provide better virtual thread testing.

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

Commit messages:
 - Fix virtual thread issues by using join(). Also make test threads be virtual theads when the main debuggee thread is a virtual thread.

Changes: https://git.openjdk.org/jdk/pull/14323/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14323&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8309506
  Stats: 16 lines in 2 files changed: 10 ins; 2 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/14323.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/14323/head:pull/14323

PR: https://git.openjdk.org/jdk/pull/14323


More information about the serviceability-dev mailing list