-
Notifications
You must be signed in to change notification settings - Fork 962
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
Connection ping only works for timeouts, should also catch dns faillure or node down #19
Comments
Yes, definitely agree. I'll fix this right now. We should be able to catch just I'll run some test and make sure it doesn't do anything funky. Thanks for filing this bug! |
Awesome changes, the b4e71ce commit is great too, thx! |
Sorry if I misunderstand the unit test, but if I changed the test as public function testOneGoodOneBadHostNoException()
{
$params = array('hosts' => array (
'127.0.0.1:9201',
'127.0.0.1:9200',
));
$client = new Elasticsearch\Client($params);
$client->exists(array("index" => 'test', 'type' => 'test', 'id' => 'test'));
} An exception may (as host is randomly selected, only 127.0.0.1:9201 will cause error) throw
Two changes I have made to the
It seems to me that the ES client can not bypass the dead host and uses the one alive without exception throw. |
Good catch, thanks for the bug report! I was bitten by the infamous PHP So in the default config, Code has been updated, and I tweaked your test to force the issue. I'll tag some releases in a few minutes so that this fix becomes generally available. While I was digging around, I also found another retry bug and an optimization. Thanks! |
I see it's working now. Thanks Zachary for the quick fix. BTW, I got another question about dead hosts and here is link |
The ping method in
AbstractConnection
is too lazy for me, here is the code:We only catch timeouts, but there is a lot of Exceptions that may occurs here:
If thinks the 4 of them needs to be catched, if a node goes down (issue or server maintenance) I do not want my whole application to fail.
What do you think about it?
The real issue is, with this code:
As the second node does not respond at all, the whole client is crashed with a CouldNotConnectToHost exception - we can't use the first node at all.
The text was updated successfully, but these errors were encountered: