RFR: 8305919: java/lang/Thread/virtual/HoldsLock.java#id0 failed, ThreadInfo.getLockInfo() return null

Alan Bateman alanb at openjdk.org
Sun Apr 30 18:39:00 UTC 2023


HoldsLock.java#id0 has been failing intermittently recently due to threads left over from previous tests terminating. HoldsLock.java#id1 doesn't fail as it runs in /othervm mode. The test uses ThreadMXBean::getAllThreadIds to get the ID of all threads and calls ThreadMXBean::getThreadInfo on each thread. If a thread from a previous test terminates then getThreadInfo returns null and the test fails.

The test can be trivially fixed to check for null but looking at it afresh, the test can be simplified to use existing test infrastructure and to just call ThreadMXBean::getThreadInfo on the carrier. The test can also be renamed to make it clearer that it is testing a carrier threads wait for a virtual thread. The old test includes a disabled test for Thread.holdsLock but there is further VM work required before that is useful and it would be better to develop new tests at part of that work.

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

Commit messages:
 - Initial commit

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

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


More information about the core-libs-dev mailing list