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

sync call hangs when it follows an async call (asp.net core application) #4902

Closed
bkindersleytrulioo opened this issue Sep 2, 2022 · 1 comment
Assignees
Labels

Comments

@bkindersleytrulioo
Copy link

we recently converted an asp.net core application to act as a nettcp wcf client (it was proxying through a REST api before)

we encountered a problem when a sync call follows an async call: the sync call times out, despite finishing quickly on the server side.

i found a few (relatively old) posts online that describe a similar problem:
https://aloiskraus.wordpress.com/2018/07/01/why-does-my-synchronous-wcf-call-hang/
https://stackoverflow.com/questions/37087103/wcf-client-hangs-on-any-operation-after-awaiting-async-operation-in-console-appl

and it does seem to be related to the SynchronizationContext (or lack thereof)

i have a small repro in a console app (which also doesn't have a SynchronizationContext) here:
https://github.com/bkindersleytrulioo/WCFDeadlock

i would expect that the sync call should be able to complete as it does when it does not follow an async call

at this point, i don't know enough about SynchronizationContexts or the WCF internals to really understand the issue or know what is a reasonable fix, or even to tell if it could be at all related to:
#4862

i found a couple of "workarounds" (as documented in the repro), but none that seem like very good options for a real application; we would like to convert all the usages in the client to async and avoid the problem that way, but it's not a trivial application, and that's not something we can do all at once

@HongGit
Copy link
Contributor

HongGit commented Jun 21, 2023

This was fixed in WCF Client 6.0 release.

@HongGit HongGit closed this as completed Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants