RFR: JDK-8229829: java/lang/management/ThreadMXBean/Locks.java fails with java.lang.RuntimeException: Thread WaitingThread is at WAITING state but is expected to be in Thread.State = WAITING

serguei.spitsyn at oracle.com serguei.spitsyn at oracle.com
Thu May 14 20:18:49 UTC 2020


Hi Alex,

LGTM.

Thanks,
Serguei


On 5/14/20 11:04, Alex Menkov wrote:
> I agree with the point.
>
> updated webrev (only WAITING handling is added):
> http://cr.openjdk.java.net/~amenkov/jdk15/Locks_waiting/webrev.2/
>
> --alex
>
> On 05/13/2020 19:20, David Holmes wrote:
>> Hi Alex,
>>
>> On 14/05/2020 10:55 am, Alex Menkov wrote:
>>> Hi all,
>>>
>>> Please review the fix for
>>> https://bugs.openjdk.java.net/browse/JDK-8229829
>>> webrev:
>>> http://cr.openjdk.java.net/~amenkov/jdk15/Locks_waiting/webrev/
>>>
>>> The fix adds handling for WAITING
>>
>> That part is good.
>>
>>> (and for consistency TIMED_WAITING 
>>
>> But this could be a problem. I know what your intent is but we are 
>> waiting to observe a thread transition to a state that it can't 
>> escape from, but with TIMED_WAITING the thread can escape - when the 
>> timeout elapses. So it is possible that the target becomes 
>> TIMED_WAITING before you check the state, but then leaves that state 
>> due to timeout, and then you check the state and will loop until you 
>> trigger a failure.
>>
>> Cheers,
>> David
>> -----
>>
>>> which is not used in the test) states as it has for BLOCKED state.
>>>
>>> --alex



More information about the serviceability-dev mailing list