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

Ensure we don't leak the request info if a request is cancelled #71737

Merged

Conversation

jasonmalinowski
Copy link
Member

Our trivial RPC system used for the BuildHost only allows a request to be cancelled before it's sent along the wire -- once it's sent across then it's sent for good. But if it was cancelled, we didn't clean up the tracking for it.

This was noticed while looking at a change that was potentially adding a cancellation token to the FlushAsync call (which is new in .NET 8.0) and generally ensuring we are explicit with our behavior there.

Closes #71580

Our trivial RPC system used for the BuildHost only allows a request
to be cancelled before it's sent along the wire -- once it's sent
across then it's sent for good. But if it was cancelled, we didn't clean
up the tracking for it.

This was noticed while looking at a change that was potentially adding
a cancellation token to the FlushAsync call (which is new in .NET 8.0)
and generally ensuring we are explicit with our behavior there.

Closes dotnet#71580
@jasonmalinowski jasonmalinowski self-assigned this Jan 20, 2024
@jasonmalinowski jasonmalinowski requested a review from a team as a code owner January 20, 2024 02:02
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Jan 20, 2024
await _sendingStream.FlushAsync().ConfigureAwait(false);
#pragma warning restore CA2016
// The only cancellation we support is cancelling before we are able to write the request to the stream; once it's been written
// the other side will execute it to completion. Thus cancellationToken is checked here, but nowhere else.
Copy link
Member Author

Choose a reason for hiding this comment

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

And I should say: it's absolutely possible to be fancier here with cancellation handling, but the whole point of this RPC system is to be trivial. And practically MSBuildWorkspace often can't pass a cancellation token anyways so spending time on making this fancier is just a waste of time.

@jasonmalinowski jasonmalinowski removed the untriaged Issues and PRs which have not yet been triaged by a lead label Jan 22, 2024
@jasonmalinowski jasonmalinowski merged commit be8d58b into dotnet:main Jan 31, 2024
28 checks passed
@jasonmalinowski jasonmalinowski deleted the fix-cancellation-handling branch January 31, 2024 19:56
@ghost ghost added this to the Next milestone Jan 31, 2024
@jjonescz jjonescz modified the milestones: Next, 17.10 P2 Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rationalize FlushAsync taking a CancellationToken in net8.0
3 participants