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

Phil Race prr at openjdk.java.net
Mon Feb 14 23:35:14 UTC 2022


On Thu, 10 Feb 2022 23:57:29 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.

This pull request has now been integrated.

Changeset: 1a7b70a8
Author:    Phil Race <prr at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/1a7b70a8be0a236b98925a8320d25d88a405d595
Stats:     4 lines in 2 files changed: 1 ins; 0 del; 3 mod

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

Reviewed-by: serb

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

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



More information about the client-libs-dev mailing list