Searchkick: Faraday::TimeoutError: execution expired

Created on 3 Feb 2015  路  4Comments  路  Source: ankane/searchkick

Continue to get Faraday::TimeoutError: execution expired on all models. I have changed some code in one model, but others that haven't been changed also fail with the same error.

Faraday::TimeoutError: execution expired
    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/openssl/buffering.rb:54:in `sysread'
    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/openssl/buffering.rb:54:in `fill_rbuff'
    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/openssl/buffering.rb:201:in `gets'
    from /app/vendor/bundle/ruby/2.0.0/gems/httpclient-2.6.0.1/lib/httpclient/session.rb:356:in `gets'
    from /app/vendor/bundle/ruby/2.0.0/gems/httpclient-2.6.0.1/lib/httpclient/session.rb:876:in `block in parse_header'
    from /app/vendor/bundle/ruby/2.0.0/gems/httpclient-2.6.0.1/lib/httpclient/session.rb:872:in `parse_header'
    from /app/vendor/bundle/ruby/2.0.0/gems/httpclient-2.6.0.1/lib/httpclient/session.rb:855:in `read_header'
    from /app/vendor/bundle/ruby/2.0.0/gems/httpclient-2.6.0.1/lib/httpclient/session.rb:662:in `get_header'
    from /app/vendor/bundle/ruby/2.0.0/gems/httpclient-2.6.0.1/lib/httpclient.rb:1247:in `do_get_header'
    from /app/vendor/bundle/ruby/2.0.0/gems/httpclient-2.6.0.1/lib/httpclient.rb:1194:in `do_get_block'
    from /app/vendor/bundle/ruby/2.0.0/gems/httpclient-2.6.0.1/lib/httpclient.rb:974:in `block in do_request'
    from /app/vendor/bundle/ruby/2.0.0/gems/httpclient-2.6.0.1/lib/httpclient.rb:1082:in `protect_keep_alive_disconnected'
    from /app/vendor/bundle/ruby/2.0.0/gems/httpclient-2.6.0.1/lib/httpclient.rb:969:in `do_request'
    from /app/vendor/bundle/ruby/2.0.0/gems/httpclient-2.6.0.1/lib/httpclient.rb:822:in `request'
    from /app/vendor/bundle/ruby/2.0.0/gems/faraday-0.9.0/lib/faraday/adapter/httpclient.rb:33:in `call'
    from /app/vendor/bundle/ruby/2.0.0/gems/faraday-0.9.0/lib/faraday/rack_builder.rb:139:in `build_response'
... 11 levels...
    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/notifications.rb:159:in `block in instrument'
    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/notifications.rb:159:in `instrument'
    from /app/vendor/bundle/ruby/2.0.0/gems/searchkick-0.8.5/lib/searchkick/logging.rb:46:in `import_with_instrumentation'
    from /app/vendor/bundle/ruby/2.0.0/gems/searchkick-0.8.5/lib/searchkick/reindex.rb:64:in `block in searchkick_import'
    from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/relation/batches.rb:75:in `find_in_batches'
    from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-deprecated_finders-1.0.3/lib/active_record/deprecated_finders/relation.rb:70:in `find_in_batches'
    from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/querying.rb:8:in `find_in_batches'
    from /app/vendor/bundle/ruby/2.0.0/gems/searchkick-0.8.5/lib/searchkick/reindex.rb:63:in `searchkick_import'
    from /app/vendor/bundle/ruby/2.0.0/gems/searchkick-0.8.5/lib/searchkick/reindex.rb:20:in `reindex'
    from (irb):1
    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/commands/console.rb:90:in `start'
    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/commands/console.rb:9:in `start'
    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/commands.rb:62:in `<top (required)>'
    from /app/bin/rails:4:in `require'
    from /app/bin/rails:4:in `<main>'irb(main):002:0> 

Most helpful comment

You can change the default timeout the elasticsearch client uses. Throw this in an initializer:

Searchkick.client = Elasticsearch::Client.new(hosts: ["localhost:9200"], retry_on_failure: true, transport_options: {request: {timeout: 250}})

All 4 comments

Ok after some more investigation, it seems like this is only caused when using text or word start autocomplete.

You can change the default timeout the elasticsearch client uses. Throw this in an initializer:

Searchkick.client = Elasticsearch::Client.new(hosts: ["localhost:9200"], retry_on_failure: true, transport_options: {request: {timeout: 250}})

Just to note, I've got similar error, but only '127.0.0.1:9200' helped me out (not localhost), tried to dig into this issue, but no luck.
So using 127.0.0.1 solve my issue, eg:

Searchkick.client = Elasticsearch::Client.new(hosts: ["127.0.0.1:9200"], retry_on_failure: true, transport_options: {request: {timeout: 250}})

Thanks to @radiofrequency for a clue!

Cleaning up issues. This is likely related to your dev setup rather than Searchkick.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ankane picture ankane  路  5Comments

yurgon picture yurgon  路  4Comments

carolliu picture carolliu  路  3Comments

namila picture namila  路  4Comments

cubaraphael picture cubaraphael  路  3Comments