-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Deadlocks during Nest.ElasticClient.Get calls #6342
Comments
I am wondering - why don't you use |
So to test it over the weekend I have created this simple solution. It consists of several different projects:
Projects which tests NEST from .NET5 source code and .NET 6 source code
These projects use NEST to call group of endpoints. It simply asks over and over again with 1s interval for simple index in ES. I found out here that .NET 5 works pretty fine and it is able to call over 100 requests/s without any significant increase in threads. Whereas switch to .NET 6 will lead (when firing about 40 requests/s) to application freeze because it will constantly add new threads. Projects testing behavior of single HttpClient instance when sending requests to one Elasticsearch node
These projects use single instance of HttpClient to call just one endpoint. Again it simply asks one index on one node for a data. For both .NET 5 and .NET 6 there is the same behavior. About 40 requests/s (on my laptop) makes them fail over time - increase in threads. This is not an ES issue, I am just finding out some baseline for my computer. When exceeding 40 requests/s in this setup, it will lead to opening up new connections until some maximum is reached => new threads are created, but all threads are locked up in wait. Projects testing behavior of HttpClientFactory, sending requests to one Elasticsearch node
These projects use HttpClientFactory to call just one endpoint. Same calls as before. But different behavior (partially expected). .NET 6 project will start failing when running about 100 requests/s, although again about 40 of them are really processed. The more requests I create the less are really going through. It does create new threads over time. Ultimately leading to fail. Test if change from async call in ES to sync call in ES changes anything
To test my original hypothesis, I changed following line But I found out that this changes nothing and code behaves the same way. Summary
Problem/QuestionOur problem is that we are blocked by this, because we are unable to migrate to .NET 6 with this issue appearing. When we change from .NET 5 to .NET 6 our main web app goes to deadlock within 30 minutes of running. On the picture below you can find our ES cluster. Question is if there are any tips for running it in .NET 6, or if we should wait for some new version? Many thanks! |
Also I can confirm, that it works (more than good) when using Async method |
Sorry for the delay here @suchoss. As mentioned on Twitter, this is due to a limitation of the .NET Standard API surface for |
Hello @stevejgordon, Thanks for info. I am working on rewriting our app to Async. |
NEST/Elasticsearch.Net version:
7.17
Elasticsearch version:
7.17.1
.NET runtime version:
.NET6
Operating system version:
Windows 10
Description of the problem including expected versus actual behavior:
Deadlocks probably caused by calling async from synchronous code in
elasticsearch-net/src/Elasticsearch.Net/Connection/HttpConnection.cs
Line 93 in 06ddfd3
This didn't appear when we used .NET 5. But if we update to .NET 6 (and change nothing else than .NET version) this problem appears.
Steps to reproduce:
Expected behavior
No deadlocks.
Provide
ConnectionSettings
(if relevant):Provide
DebugInformation
(if relevant):The text was updated successfully, but these errors were encountered: