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

Enable async-over-sync Task in Dns to be canceled #48684

Merged
merged 1 commit into from
Feb 24, 2021

Conversation

stephentoub
Copy link
Member

While we can't currently cancel the synchronous call, we can at least cancel the Task prior to its being executed.

While we can't currently cancel the synchronous call, we can at least cancel the Task prior to its being executed.
@ghost
Copy link

ghost commented Feb 24, 2021

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

Issue Details

While we can't currently cancel the synchronous call, we can at least cancel the Task prior to its being executed.

Author: stephentoub
Assignees: -
Labels:

area-System.Net

Milestone: -

@stephentoub stephentoub added this to the 6.0.0 milestone Feb 24, 2021
@geoffkizer
Copy link
Contributor

Do we have test for this? At least for pre-cancellation?

@gfoidl
Copy link
Member

gfoidl commented Feb 24, 2021

Do we have test for this? At least for pre-cancellation?

We have

public async Task DnsGetHostEntry_PreCancelledToken_Throws()

@stephentoub
Copy link
Member Author

Do we have test for this? At least for pre-cancellation?

This is hard to test well. We have a test for pre-cancellation, but we also have an upfront check for cancellation. So a test would need to trigger cancellation after the upfront check and before the thread pool processes the task. We could try issuing a bunch of requests and canceling them and hoping one gets canceled, e.g.
https://github.com/dotnet/runtime/pull/47036/files#diff-7c86b2d75d9c87e8aa5eb156215b9eb6eade4faef633a6e7d0d015f5459a3962R268
but I'm not sure it's worth it.

@stephentoub stephentoub merged commit dc76555 into dotnet:master Feb 24, 2021
@stephentoub stephentoub deleted the dnscancel branch February 24, 2021 14:54
@ghost ghost locked as resolved and limited conversation to collaborators Mar 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants