RFR: 8269091: javax/sound/sampled/Clip/SetPositionHang.java failed with ArrayIndexOutOfBoundsException: Array index out of range: -4 [v2]

Sergey Bylokhov serb at openjdk.java.net
Mon Feb 14 23:19:09 UTC 2022


On Fri, 11 Feb 2022 23:28:43 GMT, Phil Race <prr at openjdk.org> wrote:

>> This test has started failing since we got M1 macs to test on. I don't think we've ever seen this failure elsewhere.
>> I don't know what it is about that architecture that makes it more likely but I can see how it can happen when multiple threads are using the same instance. 
>> 
>>                     if (newFramePosition >= 0) { 
>>                         clipBytePosition = newFramePosition * frameSize; 
>>                         newFramePosition = -1; 
>>                     } 
>> 
>> newFramePosition is declared volatile which does make it quite possible that after the read and before the use it will have changed.
>> 
>> The fix just synchronizes this block to prevent it.
>
> Phil Race has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8269091: javax/sound/sampled/Clip/SetPositionHang.java failed with ArrayIndexOutOfBoundsException: Array index out of range: -4

Marked as reviewed by serb (Reviewer).

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

PR: https://git.openjdk.java.net/jdk/pull/7436



More information about the client-libs-dev mailing list