RFR: 8309334: ProcessTools.main() does not properly set thread names when using the virtual thread wrapper [v2]

Chris Plummer cjplummer at openjdk.org
Sat Jun 3 21:18:23 UTC 2023


> Normally when a virtual thread wrapper is used to run a test, the main thread is renamed to "old-m-a-i-n" and the new virtual thread that will act as the main thread is named "main". Neither is being done by `ProcessTools.main()`. This can cause problems for tests that expect the main thread that the test is running in to be called "main". It is instead left unnamed. This is causing the following 4 tests to fail:
> 
> com/sun/jdi/JdbMethodExitTest.java
> com/sun/jdi/JdbStepTest.java
> com/sun/jdi/JdbStopThreadTest.java
> com/sun/jdi/JdbStopThreadidTest.java
> 
> These tests also fail due to [JDK-8309397](https://bugs.openjdk.org/browse/JDK-8309397), which will be fixed after this CR, and also com/sun/jdi/JdbMethodExitTest.java fails due to [JDK-8309396](https://bugs.openjdk.org/browse/JDK-8309396), which will also subsequently be fixed.
> 
> Note this fix messed up one runtime test. It was expecting an exception message to mention the "main" thread rather than "old-m-a-i-n". Loosening the exception message matching pattern a bit solved the problem.
> 
> Testing was done by running all of tier1 and tier5.

Chris Plummer has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:

 - Merge branch 'master' into 8309334_processtools
   merge
 - when using virtual threads, properly name the main threads

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/14292/files
  - new: https://git.openjdk.org/jdk/pull/14292/files/e53abaf4..de5ca147

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=14292&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14292&range=00-01

  Stats: 4052 lines in 65 files changed: 3213 ins; 625 del; 214 mod
  Patch: https://git.openjdk.org/jdk/pull/14292.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/14292/head:pull/14292

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


More information about the core-libs-dev mailing list