Skip to content
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

[release/7.0] Throw on incompatible WebSocket options #75014

Merged
merged 4 commits into from
Sep 6, 2022

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Sep 2, 2022

Backport of #74473 to release/7.0

Fixes #74415
Fixes #74416

Customer Impact

We added support for WebSockets over HTTP/2 in .NET 7 RC1. As part of that change, we also introduced a new overload of ConnectAsync that accepts an HttpMessageInvoker to allow reusing existing pooled connections.

This PR fixes two issues related to user input validation:

The first is #74416 where existing options available on ClientWebSocketOptions (e.g. Proxy, RemoteCertificateValidationCallback) would be silently ignored if a custom HttpMessageInvoker was also specified.
This PR makes it so that if any incompatible options are set and an invoker is specified, we will throw. This gives the developer a clear signal of what must be changed.

The second issue is #74415, where a developer attempting to utilize the new feature may fall into a performance trap. THE point of WebSockets over H/2 is the ability to multiplex WebSocket streams over a single transport connection. If the user only changes the Version or VersionPolicy to allow for H/2, the implementation will use the requested protocol, but it will always open a new connection for each WebSocket, eliminating the benefit of said feature. To get the full benefit of H/2, the user must specify the invoker instance that should be reused by passing it to ConnectAsync.
This PR makes it so that we throw if H/2 is requested but an invoker was not specified.

Testing

Added a number of targeted unit tests.

Risk

Low - these are new APIs introduced in recent 7.0 RC1 (technically in Preview 7, but the feature had a bug so it did not work), we believe very few users are consuming them already.
For those that are, we believe that scenarios that can be affected are misconfigurations.

With #74416 the options were being ignored, so any testing done by the user relying on these options would show that the scenario is broken. This change just makes debugging the issue easier for the developer.

With #74415 we are talking about a brand new feature that has limited support in the ecosystem (Kestrel is also adding it in 7.0). We believe the number of customers that are already using it with 7.0 RC1 in production is close to none, but we still consider it a breaking change against RC1 and will document it as such.
Any impacted user upgrading from RC1 to 7.0 RC2/RTW that did any testing prior to deployment to production would immediately observe the exception.

@ghost
Copy link

ghost commented Sep 2, 2022

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

Backport of #74473 to release/7.0

/cc @MihaZupan

Customer Impact

Testing

Risk

IMPORTANT: Is this backport for a servicing release? If so and this change touches code that ships in a NuGet package, please make certain that you have added any necessary package authoring and gotten it explicitly reviewed.

Author: github-actions[bot]
Assignees: -
Labels:

area-System.Net

Milestone: -

@MihaZupan MihaZupan added this to the 7.0.0 milestone Sep 2, 2022
@MihaZupan MihaZupan requested a review from a team September 2, 2022 19:17
@carlossanlop
Copy link
Member

@dotnet/ncl need a code review sign off.
@danmoseley (or @karelz on Dan's behalf), PTAL for an approval.

@karelz karelz added the breaking-change Issue or PR that represents a breaking API or functional change over a prerelease. label Sep 3, 2022
@ghost ghost added the needs-breaking-change-doc-created Breaking changes need an issue opened with https://github.com/dotnet/docs/issues/new?template=dotnet label Sep 3, 2022
@ghost
Copy link

ghost commented Sep 3, 2022

Added needs-breaking-change-doc-created label because this PR has the breaking-change label.

When you commit this breaking change:

  1. Create and link to this PR and the issue a matching issue in the dotnet/docs repo using the breaking change documentation template, then remove this needs-breaking-change-doc-created label.
  2. Ask a committer to mail the .NET Breaking Change Notification DL.

Tagging @dotnet/compat for awareness of the breaking change.

@MihaZupan MihaZupan added the Servicing-consider Issue for next servicing release review label Sep 5, 2022
@danmoseley danmoseley removed the Servicing-consider Issue for next servicing release review label Sep 6, 2022
@danmoseley
Copy link
Member

Approved -- fixes to likely pain points (2 pits of failure) in new scenario. Few existing users to break, and codepath does not affect existing 1.1 scenario

@CarnaViire
Copy link
Member

Breaking change doc issue: dotnet/docs#31430

@CarnaViire CarnaViire removed the needs-breaking-change-doc-created Breaking changes need an issue opened with https://github.com/dotnet/docs/issues/new?template=dotnet label Sep 27, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Oct 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Net breaking-change Issue or PR that represents a breaking API or functional change over a prerelease.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants