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

fix async logic in MultipleConnectAsync to avoid lock reentrancy issues #42919

Merged
merged 2 commits into from
Oct 6, 2020

Conversation

geoffkizer
Copy link
Contributor

Fixes #42198 (hopefully)

When sync completions occur in this logic, we are sometimes invoking the callback directly while holding the lock, which leads to lock reentrancy and all sorts of badness.

Fix the logic to avoid this.

Also add asserts to ensure we are never inadvertently reentering the lock.

@ghost
Copy link

ghost commented Sep 30, 2020

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

@runfoapp runfoapp bot mentioned this pull request Sep 30, 2020
public bool StartConnectAsync(SocketAsyncEventArgs args, DnsEndPoint endPoint)
{
IAsyncResult result;
Copy link
Member

Choose a reason for hiding this comment

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

Unrelated to your pr, it'd be nice for the next release to remove all of the APM usage from these code paths.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed

@geoffkizer geoffkizer merged commit 214458e into dotnet:master Oct 6, 2020
@geoffkizer geoffkizer deleted the fix42198 branch November 7, 2020 23:38
@ghost ghost locked as resolved and limited conversation to collaborators Dec 8, 2020
@karelz karelz added this to the 6.0.0 milestone Jan 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.

Cancellation of Socket.ConnectAsync intermitently hangs
4 participants