kidpollo / tanker

IndexTank Integration with your fav ORM

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sometimes indextank servers fail

rnaud opened this issue · comments

I get a lot of "getaddrinfo: Name or service not known" from my app, with the following log :

/usr/ruby1.9.2/lib/ruby/1.9.1/net/http.rb:644:in `initialize'
/usr/ruby1.9.2/lib/ruby/1.9.1/net/http.rb:644:in `open'
/usr/ruby1.9.2/lib/ruby/1.9.1/net/http.rb:644:in `block in connect'
/usr/ruby1.9.2/lib/ruby/1.9.1/timeout.rb:44:in `timeout'
/usr/ruby1.9.2/lib/ruby/1.9.1/timeout.rb:87:in `timeout'
/usr/ruby1.9.2/lib/ruby/1.9.1/net/http.rb:644:in `connect'
/usr/ruby1.9.2/lib/ruby/1.9.1/net/http.rb:637:in `do_start'
/usr/ruby1.9.2/lib/ruby/1.9.1/net/http.rb:626:in `start'
/app/.bundle/gems/ruby/1.9.1/gems/tanker-1.1.4/lib/indextank_client.rb:48:in `execute'
/app/.bundle/gems/ruby/1.9.1/gems/tanker-1.1.4/lib/indextank_client.rb:22:in `PUT'
/app/.bundle/gems/ruby/1.9.1/gems/tanker-1.1.4/lib/indextank_client.rb:138:in `add_document'
/app/.bundle/gems/ruby/1.9.1/gems/tanker-1.1.4/lib/tanker.rb:348:in `update_tank_indexes'

Is there a way to fix this ?

I get similar issues the second i get a little load on the search:

….rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb: 644:in `initialize'
….rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb: 644:in `open'
….rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb: 644:in `block in connect'
…/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/timeout.rb:  44:in `timeout'
…/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/timeout.rb:  89:in `timeout'
….rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb: 644:in `connect'
….rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb: 637:in `do_start'
….rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb: 626:in `start'
…y-1.9.2-p290/gems/tanker-1.1.4/lib/indextank_client.rb:  48:in `execute'
…y-1.9.2-p290/gems/tanker-1.1.4/lib/indextank_client.rb:  15:in `GET'
…y-1.9.2-p290/gems/tanker-1.1.4/lib/indextank_client.rb: 183:in `search'
…m/gems/ruby-1.9.2-p290/gems/tanker-1.1.4/lib/tanker.rb: 113:in `search'
…m/gems/ruby-1.9.2-p290/gems/tanker-1.1.4/lib/tanker.rb: 244:in `search_tank'

as this is evaluation only for now, the index is incredibly small (21 records..), but it seems it does not like to be hit to quickly in a row...

It would be cool to have better error recovery in case of a fail I agree

In my case, the failure is definitely related to how the connection is being done. I've tried using the tanker gem (which functionally I prefer over the others), thinkingtank and the original indextank gems, and the only gem having this issue when a lot of searches are pushed through it is unfortunately tanker gem.

From the stack trace the error seems to be happening beyond the gems scope on net/http. There could be better handling for this errors. Can you give me information on which exeptions are you getting so I can handle those specifically?

Another recomendation is to upgrade to using ruby 1.9.2 its far more stable than 1.9.1

Actually we are using ruby 1.9.2, the folder structure is just a bit weird.
Small idea on the top of my head, wouldn't it be possible to put all the updating of the indextank base into a delayed job ?
I do not care for my part if the indexing is not instant.

of course that why tanker does not assume anything of your model, you can drop the update_index call anywhere!