This fixes the test which is unreliable and fails intermittently from time to time. The test was failing in the method `checkReentrantLock()` when checking expected state with `vt.getState()`. The issue is that the call to `ThreadListStackTracesTest.reentrantLock.lock()` in a `ReentrantLockTestTask` can reach waiting state on some class loading but not on the ReentrantLock. Please see the first comment for details. The fix is to add some sleep before call to the checkStates().
Testing: - submitted about thousands of mach5 runs of the `ThreadListStackTracesTest` test runs before and after the fix - TBD: submit mach5 tiers 1-3 to be completely safe ------------- Commit messages: - 8371502: serviceability/jvmti/vthread/ThreadListStackTracesTest/ThreadListStackTracesTest.java failing Changes: https://git.openjdk.org/jdk/pull/28734/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28734&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8371502 Stats: 2 lines in 1 file changed: 1 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/28734.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/28734/head:pull/28734 PR: https://git.openjdk.org/jdk/pull/28734
