Skip to content
This repository has been archived by the owner. It is now read-only.

8268342: java/foreign/channels/TestAsyncSocketChannels.java fails with "IllegalStateException: This segment is already closed" #30

Closed

Conversation

@ChrisHegarty
Copy link
Member

@ChrisHegarty ChrisHegarty commented Jun 11, 2021

There is the possibility for a race in the test, where the outbound socket buffer is still being filled, after 5 seconds, when the main test thread tries to close the resource scope.

The test has been updated to set the send/receive buffer sizes in an attempt/hint to limit the accepted/connected socket buffer sizes. Actual buffer sizes in use will likely be larger due to TCP auto-tuning, but the hint typically reduces the overall scaled sizes. This is primarily to stabilize outstanding write operations. Additionally, to ameliorate the wait-for-writebuf-to-fill situation, the dumb sleep 5secs has been replaced with a heuristic that checks that the number of bytes written quiesces. With these changes, the test successfully passes several thousands of runs.


Progress

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

Issue

  • JDK-8268342: java/foreign/channels/TestAsyncSocketChannels.java fails with "IllegalStateException: This segment is already closed"

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 30

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

Using diff file

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

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Jun 11, 2021

👋 Welcome back chegar! 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 label Jun 11, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Jun 11, 2021

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

  • core-libs

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 core-libs label Jun 11, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Jun 11, 2021

Webrevs

dfuch
dfuch approved these changes Jun 11, 2021
Copy link
Member

@dfuch dfuch left a comment

Looks good but you could make the logic simpler by calling latch.countDown() in the last call to completed(), instead of doing it in the first one.

out.println("spinning");
Thread.onSpinWait();
}
awaitOutstandingWrites(outstandingWriteOps);
Copy link
Member

@dfuch dfuch Jun 11, 2021

An alternative would be to delegate the call to latch.countDown() to the TestHandler subclass, and call it at the end of completed() only when outstandingWriteOps.decrementAndGet() == 0; As it stands the latch is released with the first call to completed (instead of being released with the last one) - and that's what makes this method necessary.

Copy link
Member Author

@ChrisHegarty ChrisHegarty Jun 11, 2021

Strictly speaking it wasn't necessary to touch this area of code to resolve the failures that we're seeing - I decided to refactor this into a separate method to improve readability of the test logic. Here again, awaiting for completion is not strictly necessary, just good practice to ensure that all threads and operations associated with the test scenario complete before the next scenario. I'll see if this can be simplified as you suggest.

@openjdk
Copy link

@openjdk openjdk bot commented Jun 11, 2021

@ChrisHegarty 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:

8268342: java/foreign/channels/TestAsyncSocketChannels.java fails with "IllegalStateException: This segment is already closed"

Reviewed-by: dfuchs

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 2 new commits pushed to the master branch:

  • 01054e6: 8268470: CDS dynamic dump asserts with JFR RecordingStream
  • e39346e: 8268093: Manual Testcase: "sun/security/krb5/config/native/TestDynamicStore.java" Fails with NPE

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
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 label Jun 11, 2021
@ChrisHegarty
Copy link
Member Author

@ChrisHegarty ChrisHegarty commented Jun 14, 2021

/integrate

@openjdk
Copy link

@openjdk openjdk bot commented Jun 14, 2021

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

  • 6171ae4: 8268630: ProblemList serviceability/jvmti/CompiledMethodLoad/Zombie.java on linux-aarch64
  • 01054e6: 8268470: CDS dynamic dump asserts with JFR RecordingStream
  • e39346e: 8268093: Manual Testcase: "sun/security/krb5/config/native/TestDynamicStore.java" Fails with NPE

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Jun 14, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Jun 14, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Jun 14, 2021

@ChrisHegarty Pushed as commit fe48ea9.

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
2 participants