-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Failover broken when hard exceptions occured when using *Async methods #803
Conversation
…(not only faulted tasks, synchronous version was ok but async version did not failover properly
…arly as suppose to inner maxretry exceptions. Added integration tests for the exception (which behave different in practice then theory (unit tests
… nodeif all the nodes are dead over picking the one thats dead longest would work better in practice
… Works in unit tests not in integration tests..
…uest) causing ElasticsearchServerException to throw a nullreference and .ServerError to always be null
Updated the PR to also have better MaxRetryException messages: I.e when you issues a request but all the sniffs on all the nodes failed you now see this instead of nested MaxRetryExceptions
Similary when all the pings fail you can clearly see which nodes were pinged and failed:
This PR also includes unit and integration tests to make sure exceptions bubble out the client the same for synchronous and asynchronous calls. We had unit tests for all of these but in practice things behave differently for instance HttpWebRequest by default only reads 65k of error response streams, our new integration caught this and this is now also fixed as off 856ad81. |
Tested this branch under mono too Mono does not support |
…tion-failover Failover broken when hard exceptions occured when using *Async methods
When IConnection throws a hard exception in any of the *Async methods before actual async work has been done the async routines in
Transport.cs
do not properly failover as they only failover properly for tasks in faulted state.In most cases the exception happens in a way that causes a faulted task to be returned (when reading responses asynchronously) but some of the exception happen earlier with DNS lookups (see #802) these are always synchronously and will throw a hard exception.
This PR also fixes the case where a hard exception during pinging/sniffing using the Async methods could cause a connection not to failover.
The synchronous versions all behave correctly during hard exceptions.