On Mon, 4 Mar 2024 10:09:10 GMT, Serguei Spitsyn <[email protected]> wrote:
>> test/hotspot/jtreg/serviceability/jvmti/ObjectMonitorUsage/ObjectMonitorUsage.java
>> line 319:
>>
>>> 317: try {
>>> 318: ready = true;
>>> 319: lockCheck.wait();
>>
>> Spurious wakeups will break this test. They shouldn't happen but ...
>
> I have an idea how to fix it but it will add extra complexity. Not sure it is
> worth it.
> It is possible to identify there was a spurious wakeup and invalidate the
> sub-test result in such a case.
> Not sure if it is important to rerun the sub-test then.
> What do you think?
Sorry I missed this response. I can't see a way to address spurious wakeups in
this case as it needs to be a per-thread flag (so that each thread knows it was
notified) but you don't know which thread will be notified in any given call to
`notify()`. I also can't see how you can detect a spurious wakeup in this code.
If they happen then a subtest may fail due to an unexpected number of
re-entering threads.
I think we will just have to see how stable the test is in practice.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17680#discussion_r1519071056