-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8349662: SSLTube SSLSubscriptionWrapper has potential races when switching subscriptions #23515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ching subscriptions
|
👋 Welcome back dfuchs! A progress list of the required criteria for merging this PR into |
|
@dfuch 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: 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 26 new commits pushed to the
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 |
|
/label remove security |
|
@dfuch |
Webrevs
|
| Flow.Subscription sub = delegate; | ||
| if (sub != null && n > 0) { | ||
| sub.request(n); | ||
| final long demand = n; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello Daniel, is this demand variable necessary? From what I see, we could just keep using n wherever we use demand in this method. I think that would also avoid the confusion between demanded and this demand variables that are used in this method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
| BodyPublisher reqBody = BodyPublishers.ofString(body); | ||
| HttpRequest.Builder builder = HttpRequest.newBuilder(uri).version(clientVersion) | ||
| URI baseReq = URI.create(uri + "?iteration=" + i + ",async=" + async | ||
| + ",addHeaders=" + addHeaders + ",preemptive=" + preemptive |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this (and the other places where we are updating the request URI) use & instead of ,, for request query parameter delimiting or is this just changed for better logging (on the server side)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a change so that we can better follow out what belong to which request in the logs (whether client & server). The query is not used/parsed anywhere - it's just there for better diagnosis when the test fails.
| if (error != null) throw error; | ||
| if (error != null) { | ||
| if (failed != null) error.addSuppressed(failed); | ||
| throw error; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think an additional error != failed check would be needed here, before calling addSuppressed() or is that not a concern here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error is a brand new AsssertionError created by the tracker. It simply can't be the same exception as failed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right - I missed that error is declared and assigned just one line above this and that can only be an AssertionError.
jaikiran
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes look reasonable to me.
|
/integrate |
|
Going to push as commit 5ee44c1.
Your commit was automatically rebased without conflicts. |
Hi,
Please find here a change that fixes a potential race condition in SSLTube.SSLSubscriptionWrapper.
Typically the race may get triggered if the demand increased by request() is not exhausted by the time
the subscription is switched by setSubscription.
Some synchronization is required to present a consistent view of the subscripton state, so that pending demand can be consistently transferred to the new the subscription.
This mostly affects HTTP/1.1 over TLS since each new exchange will cause the subscription to be switched to the new exchange. The race condition is elusive and hard to reproduce. when it occurs, it mostly causes tests to fail in jtreg timeout as the demand from upstream may not be transferred properly.
Some additional logging has been added to the DigestEchoClient.java test class (which is used by DigestEchoClientSSL) to help diagnosability of intermittent failures in these tests.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/23515/head:pull/23515$ git checkout pull/23515Update a local copy of the PR:
$ git checkout pull/23515$ git pull https://git.openjdk.org/jdk.git pull/23515/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 23515View PR using the GUI difftool:
$ git pr show -t 23515Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/23515.diff
Using Webrev
Link to Webrev Comment