Skip to content

HTTPClient::KeepAliveDisconnected when the node request is timing out #1032

@kushal-ladha

Description

@kushal-ladha

I am initializing my connection like

Elasticsearch::Client.new hosts: ['https://<ip-of-node1>:9200', 'https://<ip-of-node2>:9200'].
with following options - {reload_on_failure: true, reload_connections: true}.

Whenever there is request timeout on any of these nodes, I am getting the following traceback -
Traceback (most recent call last): from faraday (0.9.2) lib/faraday/connection.rb:377:in run_request'
from faraday (0.9.2) lib/faraday/rack_builder.rb:139:in build_response' from faraday (0.9.2) lib/faraday/adapter/httpclient.rb:36:in call'
from httpclient (2.7.2) lib/httpclient.rb:858:in request' from httpclient (2.7.2) lib/httpclient.rb:1016:in do_request'
from httpclient (2.7.2) lib/httpclient.rb:1127:in protect_keep_alive_disconnected' from httpclient (2.7.2) lib/httpclient.rb:1134:in rescue in protect_keep_alive_disconnected'
from httpclient (2.7.2) lib/httpclient.rb:1021:in block in do_request' from httpclient (2.7.2) lib/httpclient.rb:1241:in do_get_block'
from httpclient (2.7.2) lib/httpclient.rb:1294:in do_get_header' from httpclient (2.7.2) lib/httpclient/session.rb:547:in get_header'
from httpclient (2.7.2) lib/httpclient/session.rb:771:in read_header' from httpclient (2.7.2) lib/httpclient/session.rb:788:in parse_header'
from /opt/ruby-2.7.1/lib/ruby/2.7.0/timeout.rb:105:in timeout' from /opt/ruby-2.7.1/lib/ruby/2.7.0/timeout.rb:95:in block in timeout'
from httpclient (2.7.2) lib/httpclient/session.rb:795:in block in parse_header' HTTPClient::KeepAliveDisconnected (HTTPClient::KeepAliveDisconnected: )

I see that in elasticsearch-transport-5.0.5/lib/elasticsearch/transport/transport/http/faraday.rb, we have defined

def host_unreachable_exceptions [::Faraday::Error::ConnectionFailed, ::Faraday::Error::TimeoutError] end

then why is TimeoutError is not reloading connection, instead giving the above exception.

To verify this, I did a curl on the same node and the request did timeout but from the gem, i am facing some issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions