-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Using connection pools throws SocketException #802
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
Comments
Hi, Just tried this code on my machine (ES 1.2.2, NEST 1.0.0-rc1), and I'm not getting any exceptions:
Seems a bit strange though, are you able to reproduce it in a small console app, or is it just happening in that solution? |
Hey @andersosthus, thanks for the quick reply. I just set up a brand new blank console app and have tried to reproduce the issue. It is still not working, but now I am getting a
Again, switching the exact same code from using a |
Hi, I remember I encountered the same exception earlier in the week while creating some tests in one of our solutions, connecting locally to a single node ES cluster running on a Small VM in Azure. I ended up with this to create my client:
Not sure if this will help you or not. The ElasticClient we use in our test environment is something like this:
This works fine as well for our services, based on our initial tests. Btw, are you running ES locally when you get this issue ? |
That initialization code seemed to have fixed the issue in my standalone console but not in my main app. I just find it strange that switching from a connection pool to a single URI causes it to work. I am running against an ES cluster on EC2, not locally. My standalone console app is pointing at the exact same servers as my main app. |
Hi, Ok, you might have some other issues in your main app them, but a couple of things you could check:
In your app are you doing anything special with the client as soon as it's created, as in DI or something that might complicate things ? We use Ninject to give us a Singleton ElasticClient with the settings above, and that works fine. If you're still stuck, if I were you, I'd clone this repo and try to run the integration tests from the develop branch to see if they work. If so, you could reference the source directly in your app and step into the code to see if you can find what's going on. Another suggestion would be to try the ElasticSearch.NET client directly: Or you can wait until someone with more NEST experience comes along. They can probably provide better guidance than me :) |
Thanks a bunch for your help... Still not there, but getting closer. I just switched it to use a An operation was attempted on something that is not a socket 54.210.xx.xx:80
It may be worth noting that the nginx proxy on the server(s) has basic HTTP authentication enabled so my URLs are actually structured like this: EDIT: I also converted the code to use the basic |
Shooting blind, but you could try to create your URI like this
|
Nope. I also completely disabled the nginx basic auth on my servers and that didn't make any difference either, so I assume it's unrelated to that. |
I have fixed this, but I'm still not entirely sure what the cause was. In Visual Studio's NuGet Package Manager, I completely removed all references to NEST, cleaned the solution, closed VS, reopened and readded the NuGet package and it started working. I'm guessing there was some assembly redirect or conflict perhaps? Hopefully something here can help anyone else who has the same problem. |
…(not only faulted tasks, synchronous version was ok but async version did not failover properly
Hi @ryanvanderpol many thanks for opening this PR While its true that the RC should handle these exceptions properly, your PR did prompt me to add better unit tests for the following situations
All the async tests I wrote returned a task that will throw an exception as suppose to throwing an exception directly when called. While the synchronous calls all behaved well (which you are using) the failover of these hard exceptions when calling async methods did not all properly caused a failover to happen. this is now fixed #803 @andersosthus thanks for your sound help on this thread! A couple of things I like to clarify:
|
@Mpdreamz thanks for the clarifications. I guess I misunderstood some of those points from looking at the docs. I'll see if I can't update the Connection part of the docs to specify the stuff about A small question regarding the |
Thats correct, the only time I manage to upset elasticsearch as suppose to the client is when too issueing too many bulk requests. The actual exception returned by elasticsearch in those cases being a threadpool starvation related exception. Sometimes tweaking the threadpool settings for bulk requests helps to be able to up the concurrency but in general I would not advise changing this, it all depends on the machines/cluster and your cluster usage pattern. For example upping the bulk threadpool settings might push other threadpools to their maximum. A general rule of thumb is that the defaults elasticsearch settings comes with are golden, very seldom do they need to be touched :) Thanks for the heads up that the docs are not clear about all of this. I would love a PR in your words as I'm approaching it not with fresh eyes. |
I'm upgrading an app from an older version of NEST to
1.0.0-rc1
. One of the newer features I'm trying to use is connection pools. However, whenever I create a new client using either theStaticConnectionPool
or theSniffingConnectionPool
almost all actions against the client end up throwing aSocketException
. Here is my initialization code:Later on I go and do the following:
And I get a SocketException. There appear to be a variety of error messages. Here are some of the common ones:
Here is a stack trace:
Doing the exact same thing, but NOT using a connection pool works just fine.
Here is the info from my ES instance:
The text was updated successfully, but these errors were encountered: