Skip to content

Conversation

@prrace
Copy link
Contributor

@prrace prrace commented Feb 10, 2022

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.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

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

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/7436/head:pull/7436
$ git checkout pull/7436

Update a local copy of the PR:
$ git checkout pull/7436
$ git pull https://git.openjdk.java.net/jdk pull/7436/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 7436

View PR using the GUI difftool:
$ git pr show -t 7436

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/7436.diff

…rayIndexOutOfBoundsException: Array index out of range: -4
@bridgekeeper
Copy link

bridgekeeper bot commented Feb 10, 2022

👋 Welcome back prr! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Feb 10, 2022
@openjdk
Copy link

openjdk bot commented Feb 11, 2022

@prrace The following label will be automatically applied to this pull request:

  • client

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the client client-libs-dev@openjdk.org label Feb 11, 2022
@mlbridge
Copy link

mlbridge bot commented Feb 11, 2022

Webrevs

if (newFramePosition >= 0) {
clipBytePosition = newFramePosition * frameSize;
newFramePosition = -1;
synchronized (this) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe instead of synchronization we can read it to the local variable,then use, then reset to -1? This class already has many different locks used for synchronization and this one add another one for "this".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose both should avoid this specific problem. But yes, there's a lot of synchronization in this class.
FIx updated.

…rayIndexOutOfBoundsException: Array index out of range: -4
@openjdk
Copy link

openjdk bot commented Feb 14, 2022

@prrace This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

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

Reviewed-by: serb

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 48 new commits pushed to the master branch:

  • 16f649b: 8281678: appcds/dynamicArchive/ArchiveConsistency.java fails after JDK-8279997
  • 88fc3bf: 8280473: CI: Support unresolved JVM_CONSTANT_Dynamic constant pool entries
  • f07b816: 8280940: gtest os.release_multi_mappings_vm is racy
  • 9d0a4c3: 8274238: Inconsistent type for young_list_target_length()
  • 2604a88: 8281585: Remove unused imports under test/lib and jtreg/gc
  • 534e557: 8256368: Avoid repeated upcalls into Java to re-resolve MH/VH linkers/invokers
  • 95f198b: 8274980: Improve adhoc build version strings
  • c61d629: 8281553: Ensure we only require liveness from mach-nodes with barriers
  • 2597206: 8280783: Parallel: Refactor PSCardTable::scavenge_contents_parallel
  • 2632d40: 8281637: Remove unused VerifyOption_G1UseNextMarking
  • ... and 38 more: https://git.openjdk.java.net/jdk/compare/178b962e01cc6c150442bf41dc6bd199caff0042...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Feb 14, 2022
@prrace
Copy link
Contributor Author

prrace commented Feb 14, 2022

/integrate

@openjdk
Copy link

openjdk bot commented Feb 14, 2022

Going to push as commit 1a7b70a.
Since your change was applied there have been 48 commits pushed to the master branch:

  • 16f649b: 8281678: appcds/dynamicArchive/ArchiveConsistency.java fails after JDK-8279997
  • 88fc3bf: 8280473: CI: Support unresolved JVM_CONSTANT_Dynamic constant pool entries
  • f07b816: 8280940: gtest os.release_multi_mappings_vm is racy
  • 9d0a4c3: 8274238: Inconsistent type for young_list_target_length()
  • 2604a88: 8281585: Remove unused imports under test/lib and jtreg/gc
  • 534e557: 8256368: Avoid repeated upcalls into Java to re-resolve MH/VH linkers/invokers
  • 95f198b: 8274980: Improve adhoc build version strings
  • c61d629: 8281553: Ensure we only require liveness from mach-nodes with barriers
  • 2597206: 8280783: Parallel: Refactor PSCardTable::scavenge_contents_parallel
  • 2632d40: 8281637: Remove unused VerifyOption_G1UseNextMarking
  • ... and 38 more: https://git.openjdk.java.net/jdk/compare/178b962e01cc6c150442bf41dc6bd199caff0042...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Feb 14, 2022
@openjdk openjdk bot closed this Feb 14, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Feb 14, 2022
@openjdk
Copy link

openjdk bot commented Feb 14, 2022

@prrace Pushed as commit 1a7b70a.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client client-libs-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

2 participants