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 sync/async deadlock #404

Merged
merged 5 commits into from
Aug 13, 2020

Conversation

jasper-d
Copy link
Contributor

@jasper-d jasper-d commented Jul 30, 2020

Fixes a deadlock #395 using TaskCreationOptions.RunContinuationsAsynchronously on netstandard1.6.
No integration test because I couldn't make it fail reliably (before the fix).

Upgraded to net46 since #394 will do it anyways and it avoids an ugly workaround.

@watfordgnf
Copy link
Collaborator

I don't think its a dependency we can take, but Microsoft's vs-threading repo has nice handlers for sync-over-async (aka JoinableTaskFactory) that perhaps would be a solution in this space.

@jasper-d
Copy link
Contributor Author

@jasper-d jasper-d marked this pull request as ready for review August 3, 2020 22:15
@jasper-d jasper-d marked this pull request as draft August 3, 2020 22:16
@jasper-d jasper-d marked this pull request as ready for review August 3, 2020 22:32
@jasper-d jasper-d marked this pull request as draft August 3, 2020 23:05
@jasper-d jasper-d marked this pull request as ready for review August 4, 2020 18:14
Copy link
Member

@ColinSullivan1 ColinSullivan1 left a comment

Choose a reason for hiding this comment

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

LGTM.

@ColinSullivan1
Copy link
Member

Thanks!

throw;
}

return request.Waiter.Task.GetAwaiter().GetResult();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this still timeout after timeout milliseconds?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, timeout is passed through setupRequest to InflightRequest where it's used to set the timeout.https://github.com/nats-io/nats.net/blob/ec0a317bde5cf0b7d88a5e63c83ae43527d0274c/src/NATS.Client/Internals/InFlightRequest.cs#L72

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants