elasticsearch-ruby: elasticsearch-transport will cause stack overflow if host is unreachable and reload_on_failure is true

Code that reproduces:

require 'rspec'
require 'elasticsearch'

describe 'bug in es transport' do
  it 'should not stack overflow' do
    hosts = %w(1.2.3.4 5.6.7.8 9.10.11.12)
    client = Elasticsearch::Client.new hosts: hosts, retry_on_failure: true, reload_connections: true, reload_on_failure: true, transport_options: {request: {timeout: 10}}
    client.cluster.health
  end
end

stack trace:

SystemStackError: stack level too deep
/Users/cmeyer/.rvm/gems/ruby-2.2.2/gems/faraday-0.9.1/lib/faraday/connection.rb:406:in `build_exclusive_url'
/Users/cmeyer/.rvm/gems/ruby-2.2.2/gems/faraday-0.9.1/lib/faraday/rack_builder.rb:191:in `build_env'
/Users/cmeyer/.rvm/gems/ruby-2.2.2/gems/faraday-0.9.1/lib/faraday/rack_builder.rb:139:in `build_response'
/Users/cmeyer/.rvm/gems/ruby-2.2.2/gems/faraday-0.9.1/lib/faraday/connection.rb:377:in `run_request'
/Users/cmeyer/.rvm/gems/ruby-2.2.2/gems/elasticsearch-transport-1.0.9/lib/elasticsearch/transport/transport/http/faraday.rb:21:in `block in perform_request'
/Users/cmeyer/.rvm/gems/ruby-2.2.2/gems/elasticsearch-transport-1.0.9/lib/elasticsearch/transport/transport/base.rb:187:in `call'
/Users/cmeyer/.rvm/gems/ruby-2.2.2/gems/elasticsearch-transport-1.0.9/lib/elasticsearch/transport/transport/base.rb:187:in `perform_request'
/Users/cmeyer/.rvm/gems/ruby-2.2.2/gems/elasticsearch-transport-1.0.9/lib/elasticsearch/transport/transport/http/faraday.rb:20:in `perform_request'
/Users/cmeyer/.rvm/gems/ruby-2.2.2/gems/elasticsearch-transport-1.0.9/lib/elasticsearch/transport/transport/sniffer.rb:31:in `block in hosts'
/Users/cmeyer/.rvm/gems/ruby-2.2.2/gems/elasticsearch-transport-1.0.9/lib/elasticsearch/transport/transport/sniffer.rb:30:in `hosts'
/Users/cmeyer/.rvm/gems/ruby-2.2.2/gems/elasticsearch-transport-1.0.9/lib/elasticsearch/transport/transport/base.rb:71:in `reload_connections!'
/Users/cmeyer/.rvm/gems/ruby-2.2.2/gems/elasticsearch-transport-1.0.9/lib/elasticsearch/transport/transport/base.rb:198:in `rescue in perform_request'
/Users/cmeyer/.rvm/gems/ruby-2.2.2/gems/elasticsearch-transport-1.0.9/lib/elasticsearch/transport/transport/base.rb:177:in `perform_request'
/Users/cmeyer/.rvm/gems/ruby-2.2.2/gems/elasticsearch-transport-1.0.9/lib/elasticsearch/transport/transport/http/faraday.rb:20:in `perform_request'
/Users/cmeyer/.rvm/gems/ruby-2.2.2/gems/elasticsearch-transport-1.0.9/lib/elasticsearch/transport/transport/sniffer.rb:31:in `block in hosts'
/Users/cmeyer/.rvm/gems/ruby-2.2.2/gems/elasticsearch-transport-1.0.9/lib/elasticsearch/transport/transport/sniffer.rb:30:in `hosts'
/Users/cmeyer/.rvm/gems/ruby-2.2.2/gems/elasticsearch-transport-1.0.9/lib/elasticsearch/transport/transport/base.rb:71:in `reload_connections!'
/Users/cmeyer/.rvm/gems/ruby-2.2.2/gems/elasticsearch-transport-1.0.9/lib/elasticsearch/transport/transport/base.rb:198:in `rescue in perform_request'
/Users/cmeyer/.rvm/gems/ruby-2.2.2/gems/elasticsearch-transport-1.0.9/lib/elasticsearch/transport/transport/base.rb:177:in `perform_request'
/Users/cmeyer/.rvm/gems/ruby-2.2.2/gems/elasticsearch-transport-1.0.9/lib/elasticsearch/transport/transport/http/faraday.rb:20:in `perform_request'
/Users/cmeyer/.rvm/gems/ruby-2.2.2/gems/elasticsearch-transport-1.0.9/lib/elasticsearch/transport/transport/sniffer.rb:31:in `block in hosts'
...
...

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 20 (11 by maintainers)

Most upvoted comments

@eherot Thanks for the report. I was able to reproduce the error with the info you provided and have opened a new ticket to focus on it. We can continue the discussion there.