You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 20, 2023. It is now read-only.
Using domain-based elasticsearch hosts that change their IP over time can cause AsyncElasticsearch client to timeout requests as the default DNS cache resolves the hostname with old address.
For example, with Elasticsearch Heroku Add-ons that run on AWS, the host URL doesn't change and looks like https://abcdef-123455.eu-west-1.bonsaisearch.net, but the IP address can change over time. Because of the DNS cache - which isn't flushed - the client tries to send requests to wrong host IP and failes.
Solution might be to pass explicit use_dns_cache param to aiohttp.TCPConnectorin the constructor of AIOHttpConnection.
Additionally, because of the default DNS resolver being thread-based, a dns_resolver param could be used to specify own, for example aiodns-based AsyncResolver, although it was removed as default one because of compatibility issues with IPv6 systems.
I can submit a PR with this solution soon.
What do you think?
The text was updated successfully, but these errors were encountered:
thank you very much for the report. The default that we choose should be the safest option that works everywhere (turning off DNS cache in this case).
We can then provide additional options to improve performance/experience in some circumstances, but that is not the highest priority, especially if this can be implemented as a "plugin" - a custom subclass of the Connection class we are using.
Hi!
Using domain-based elasticsearch hosts that change their IP over time can cause
AsyncElasticsearch
client to timeout requests as the default DNS cache resolves the hostname with old address.For example, with Elasticsearch Heroku Add-ons that run on AWS, the host URL doesn't change and looks like
https://abcdef-123455.eu-west-1.bonsaisearch.net
, but the IP address can change over time. Because of the DNS cache - which isn't flushed - the client tries to send requests to wrong host IP and failes.Solution might be to pass explicit
use_dns_cache
param toaiohttp.TCPConnector
in the constructor ofAIOHttpConnection
.Additionally, because of the default DNS resolver being thread-based, a
dns_resolver
param could be used to specify own, for exampleaiodns
-based AsyncResolver, although it was removed as default one because of compatibility issues with IPv6 systems.I can submit a PR with this solution soon.
What do you think?
The text was updated successfully, but these errors were encountered: