RFR: 8306446: java/lang/management/ThreadMXBean/Locks.java transient failures [v3]
Kevin Walls
kevinw at openjdk.org
Thu Jul 27 17:44:57 UTC 2023
On Thu, 27 Jul 2023 17:00:22 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:
>> Thanks for the feedback, updated.
>> On this point, the method is only invoked on a very limited set of locks and threads. It is called to examine LockAThread and LockBThread, and the test main thread (if not virtual). So it will not (should not!) see a lock owner which is some other thread, it's not a useful generic utility method.
>
> This is not that easy to make this conclusion.
> I'm thinking if placing a comment would help.
Sure. I checked again and without this "skip ForkJoinPool" logic, JTREG_TEST_THREAD_FACTORY=Virtual causes failures.
This method checks in all the threadInfos, that the specified lock is blocking the expectedThreads (our test threads t1, t2 and mainThread if it's not Virtual)
If it sees a FJP thread that is blocked on a java.lang.VirtualThread, and that's not one of the expected threads, so the counting is wrong and we fail.
I cannot say I like the loop. 8-)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14501#discussion_r1276616255
More information about the serviceability-dev
mailing list