Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | SDKs | SDKs

"Curl::Err::HostResolutionError" with couchbase ruby gem

1 reply [Last post]
  • Login or register to post comments
Sun, 12/04/2011 - 11:13
tompat
Offline
Joined: 12/04/2011
Groups: None

Hello,

I recently setup a couchdb server. All requests on the couchdb server are performed via a ruby web server. I use the "couchbase" gem to communicate between ruby and couchbase.

My problem is:

When i request a couchbase document via my ruby web server, I have totally randomly a server error:

===== Ruby server log =====
"Curl::Err::HostResolutionError"

===== couchbase log =====
* getaddrinfo(3) failed for 127.0.0.1:8091
* Couldn't resolve host '127.0.0.1'
* Expire cleared
* Closing connection #0

When the same request succeed:

===== couchbase log =====
* About to connect() to 127.0.0.1 port 8091 (#0)
* Trying 127.0.0.1... * connected
* Connected to 127.0.0.1 (127.0.0.1) port 8091 (#0)
> GET /pools/default/buckets HTTP/1.1
User-Agent: couchbase-ruby-client/0.9.7
Host: 127.0.0.1:8091
Accept: */*
< HTTP/1.1 200 OK
< Server: Membase Server 2.0.0r-1-ge4c8742
< Pragma: no-cache
< Date: Sun, 04 Dec 2011 17:55:23 GMT
< Content-Type: application/json
< Content-Length: 1539
< Cache-Control: no-cache
<
* Connection #0 to host 127.0.0.1 left intact
* About to connect() to 127.0.0.1 port 8091 (#0)
* Trying 127.0.0.1... * connected
* Connected to 127.0.0.1 (127.0.0.1) port 8091 (#0)
> GET /pools/default/bucketsStreaming/default HTTP/1.1
User-Agent: couchbase-ruby-client/0.9.7
Host: 127.0.0.1:8091
Accept: */*
< HTTP/1.1 200 OK
< Transfer-Encoding: chunked
< Server: Membase Server 2.0.0r-1-ge4c8742
< Pragma: no-cache
< Date: Sun, 04 Dec 2011 17:55:24 GMT
< Content-Type: application/json; charset=utf-8
< Cache-Control: no-cache

My configuration:
> Ubuntu 10.04 32 bits
> couchbase 2.0
> ruby 1.9.2

/!\ Important points /!\

> When I try to perform exactly the same request from my ruby console, I never have this problem.
> I have the same issue with couchbase 1.2.0 and couchbase 2.0

So my questions are:
1: Is it a known problem ? If yes, how to fix it ?
2: Is there a ruby app example somewhere using "couchbase" working without problem ? Maybe i could see in it something i'm missing.

Thanks by advance,

Best regards,

Thomas

Top
  • Login or register to post comments
Tue, 12/06/2011 - 03:11
tompat
Offline
Joined: 12/04/2011
Groups: None

Hello,

We found the problem. The curb gem tried to resolve randomly in ipv4 and ipv6.

Our fix:

In the method curl_easy of the module RestClient (rest_client.rb) we added the following option to the curl instance:
curl.resolve_mode = :ipv4

We didn't investigate the root cause of the problem but if someone has an idea, please leave a post.

Thomas

Top
  • Login or register to post comments
  • Login or register to post comments
  • Login
  • Register

Company

  • About Us
  • Leadership
  • Customers
  • Partners
  • Contact Us

Product

  • Couchbase Server
  • Couchbase SDKs
  • Use Cases
  • Documentation
  • Forums

Open Source

  • Couchbase Project
  • Couchbase vs. CouchDB

Commercial

  • Subscriptions & Support
  • Training & Services

News

  • Blog
  • Newsletter
  • Press Releases
  • Buzz

Follow Us

    
  • Customer Login
  • Terms of Service
  • Privacy Policy
  • Trademark Policy
  • Site Map

© 2013 COUCHBASE All rights reserved.

Sign in to Couchbase Community

close
  • Create new account
  • Request new password
You are logging into the Forums, Wiki and Issue Tracker