-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
In Dns.RunAsync calls AfterResolution when canceled #104435
In Dns.RunAsync calls AfterResolution when canceled #104435
Conversation
Tagging subscribers to this area: @dotnet/ncl |
src/libraries/System.Net.NameResolution/System.Net.NameResolution.sln
Outdated
Show resolved
Hide resolved
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.
What happens if the CancellationToken
is fired during the invocation of the delegate passed to prevTask.ContinueWith()
(not the previously queued task)? Isn't it possible that both continuation delegates will be invoked leading to double call into AfterResolution
?
Also, can we attempt to design a test for this? Idea for a "mini stress test": have a bunch parallel calls in a separate RemoteExecutor
process, cancel some of them, count the ResolutionStart
& ResolutionStop
events.
Because we dont pass CT to func() TLDR: I believe it is OK
Yes it will be nice to have test to validate balanced If this is a high concert I would recommend to handle it in isolated PR, as this requires, IMO, some refactoring and investigations. |
Fixes: #92045
Context
When Dns.RunAsync is canceled before it runs its action, pairing
Log.AfterResolution
was not called causing permanently incorrect telemetry counters value. See description of #92045Changes
Added
AfterResolution
inOnlyOnCanceled
registered continuation.