karmi / retire

A rich Ruby API and DSL for the Elasticsearch search engine
http://karmi.github.com/retire/
MIT License
1.86k stars 533 forks source link

RestClient - ServerBrokeConnection #875

Closed mozcomp closed 11 years ago

mozcomp commented 11 years ago

For some reason 2 different projects using tire have started getting an error from the RestClient - Server broke connection.

So I downloaded the book example, and it too gets the error ...

#2013-09-21 13:09:48:721 [_search] (["books"])
#
curl -X GET 'http://192.168.166.128:9200/books/book/_search?size=10&pretty' -d '{
  "query":{
    "query_string":{
      "query":"title:elasticsearch"
    }
  },
  "size":10
}'

#2013-09-21 13:09:48:722 [N/A] (N/A msec)

/Users/mozcomp/.rvm/gems/ruby-1.9.3-p327/gems/rest-client-1.6.7/lib/restclient/request.rb:182:in `rescue in transmit': Server broke connection (RestClient::ServerBrokeConnection)
    from /Users/mozcomp/.rvm/gems/ruby-1.9.3-p327/gems/rest-client-1.6.7/lib/restclient/request.rb:140:in `transmit'
    from /Users/mozcomp/.rvm/gems/ruby-1.9.3-p327/gems/rest-client-1.6.7/lib/restclient/request.rb:64:in `execute'
    from /Users/mozcomp/.rvm/gems/ruby-1.9.3-p327/gems/tire-0.6.0/lib/tire/http/client.rb:11:in `get'
    from /Users/mozcomp/.rvm/gems/ruby-1.9.3-p327/gems/tire-0.6.0/lib/tire/search.rb:136:in `perform'
    from /Users/mozcomp/.rvm/gems/ruby-1.9.3-p327/gems/tire-0.6.0/lib/tire/search.rb:35:in `results'
    from /Users/mozcomp/.rvm/gems/ruby-1.9.3-p327/gems/tire-0.6.0/lib/tire/model/search.rb:105:in `search'
    from /Users/mozcomp/.rvm/gems/ruby-1.9.3-p327/gems/tire-0.6.0/lib/tire/model/search.rb:298:in `search'
    from active_record_associations.rb:119:in `<main>'

It has loaded the data successfully into Elasticsearch, but the subsequent query fails.

However, using curl I can do exactly the same query successfully ..

mozcomp:tire-example mozcomp$ curl -XPOST "http://192.168.166.128:9200/books/book/_search?size=10&pretty" -d'
> {"query":{"query_string":{"query":"title:elasticsearch"}},"size":10}'
{
  "took" : 4,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "failed" : 0
  },
  "hits" : {
    "total" : 1,
    "max_score" : 2.8492718,
    "hits" : [ {
      "_index" : "books",
      "_type" : "book",
      "_id" : "1",
      "_score" : 2.8492718, "_source" : {"created_at":"2013-09-21T13:09:48+10:00","id":1,"title":"How to impress your Rails friends with elasticsearch","updated_at":"2013-09-21T13:09:48+10:00","chapters":[{"text":"The world generates more and more information ..."},{"text":"After the elasticsearch installation ..."}]}
    } ]
  }

This reflects what's happening in my other projects. I can import the index, I can add & update activerecord models that re-index elasticsearch, but I get an error as above, when searching.

I have re-installed both tire & restclient gems.

I'm sorry, I just don't know what else to look at to find the problem.

Thanks

mozcomp commented 11 years ago

Problem solved.

The reason projects ceased working was that although I have had FortiClient software installed for a long time (mainly as vpn access to a customer), I usually shut it down after use, but following a software update, my system had rebooted as part of the update and the client was still active.

By the look, the web filtering function doesn't like the additional payload in an Http Get causing the EOFERROR in RestClient. As a POST it works fine.

My knowledge of RFC's and what is defined as acceptable/non-acceptable is limited, but given the fact that some software obviously believes the payload in a GET is "bad", would it be prudent to add a configuration option governing it's use, or is it already there in front of my nose?

Thanks