Closed magkal closed 3 years ago
hi @magkal , Thank you the report. We're starting to investigate of your issue.
Regards, Endre
Hi @magkal,
I think we should split this issue into two parts:
I create some changes to replace an elegant .Result
/ .Wait
but it won't solve your ThreadPool issues. (https://github.com/configcat/.net-sdk/pull/18)
Thanks, Endre
Hi thanks for the update, You're right it's two separate issues.
We were unable to get our azure webapp starting after deploy and did some debugging with dnSpy, which always got stuck on the configcat library causing a deadlock. As soon as we refactored the code calling Sync methods in configcat, to properly await the result, our azure webapp started and was healthy.
Regarding the thread pooling is likely something else that we mixed up in this. Since we upgraded multiple packages within the same test release we did, and an issue we ran into seemed to be caused by thread pool starvation. I think it's safe to disregard that within this github issue.
/Magnus
Hi! We've ran into issues with our ThreadPool that was caused by the non async methods on the
IConfigCatClient
interface called too often in our application. Below are references to the lines in the client that calls.Result
and needs to be refactored. The use of.Result
on an async method is very dangerous and produces deadlocks. It should be refactored to either.GetAwaiter().GetResult()
or or something like this snippet, from some years ago, (microsofts entity framework team used this to get async methods run sync).https://github.com/configcat/.net-sdk/blob/7bd21b9620aaaf1175743140bd067c01ea694af3/src/ConfigCatClient/ConfigCatClient.cs#L146
https://github.com/configcat/.net-sdk/blob/7bd21b9620aaaf1175743140bd067c01ea694af3/src/ConfigCatClient/ConfigCatClient.cs#L180
https://github.com/configcat/.net-sdk/blob/7bd21b9620aaaf1175743140bd067c01ea694af3/src/ConfigCatClient/ConfigCatClient.cs#L233
https://github.com/configcat/.net-sdk/blob/7bd21b9620aaaf1175743140bd067c01ea694af3/src/ConfigCatClient/ConfigCatClient.cs#L267