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.

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

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

Changes: https://git.openjdk.java.net/jdk/pull/7436/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=7436&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8269091
  Stats: 6 lines in 2 files changed: 2 ins; 0 del; 4 mod
  Patch: https://git.openjdk.java.net/jdk/pull/7436.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/7436/head:pull/7436

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

Reply via email to