Skip to content
This repository has been archived by the owner on Jan 2, 2023. It is now read-only.

resolver broken in 1.1.0pre0 if used with em-resolv-replace #50

Closed
rubycut opened this issue Oct 18, 2013 · 9 comments
Closed

resolver broken in 1.1.0pre0 if used with em-resolv-replace #50

rubycut opened this issue Oct 18, 2013 · 9 comments

Comments

@rubycut
Copy link

rubycut commented Oct 18, 2013

In 1.0.5 everything was working ok, bit now it says "invalid address":

require 'cql'
# breaks cql-rb version 1.1.0pre0
require 'em-resolv-replace'
EM.run {
  #p "trying localhost"
  #c = Cql::Client.connect(host: "localhost")
  #p "trying 8.8.8.8"
  #c = Cql::Client.connect(host: "8.8.8.8")
  p "trying 31.192.115.166"
  c = Cql::Client.connect(host: "31.192.115.166")
  EM.stop
}

Interestingly enough, it's broken only is some cases, with provided ip, otherwise if I put localhost or 8.8.8.8 then it works.

> ruby cql_em_break.rb 
"trying 31.192.115.166"
/home/hanuman/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/cql-rb-1.1.0.rc0/lib/cql/client/synchronous_client.rb:32:in `connect': invalid address (Cql::Io::ConnectionError)
        from /home/hanuman/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/cql-rb-1.1.0.rc0/lib/cql/client.rb:99:in `connect'

I traced it back to here:

https://github.com/iconara/cql-rb/blob/master/lib/cql/io/connection.rb#L34

I tried using resolver by itself and it works fine.

@michaelklishin
Copy link

Does getaddrinfo work in irb?

@iconara
Copy link
Owner

iconara commented Oct 18, 2013

I was using Ruby’s resolve-replace for a while, maybe in all of the v1.0 releases. I stopped using it because I found cases where it didn’t work, but I can’t say for sure what they were off the top of my head.

I can have a look, but I can’t promise I can make it work.

@iconara
Copy link
Owner

iconara commented Oct 18, 2013

Thanks for reporting it. I want to make sure that cql-rb doesn't interfere with other gems.

@rubycut
Copy link
Author

rubycut commented Oct 18, 2013

I am not sure what is there to resolve. I am providing ip adress, it shouldn't even try to resolve it.

I am using sinatra-synchrony which is loading em-resolv-replace automatically. I'll try to disable that.

iconara added a commit that referenced this issue Oct 28, 2013
This is an experiment to see if I can get to the bottom of #50
@iconara
Copy link
Owner

iconara commented Oct 28, 2013

@rubycut I've pushed up a branch called use_resolv that uses Resolv directly for the DNS resolution. Could you try that branch and see if it works for you? It's a stab in the dark, but maybe it'll give us some more insight into what's going on.

@rubycut
Copy link
Author

rubycut commented Nov 21, 2013

@iconara , I am pretty swamped at the moment, in the meantime, I removed dependency to em-resolv-replace from sinatra-synchrony, when I catch time, I'll try newest version again. I'll test your branch when I catch time, probably with next week.

@iconara
Copy link
Owner

iconara commented Dec 14, 2013

Have you had time to test this yet?

@rubycut
Copy link
Author

rubycut commented Dec 22, 2013

No, I suck. Being only ruby programmer in the company, I hope you understand.

@iconara
Copy link
Owner

iconara commented Mar 1, 2014

I'll close this now, the branch I created is now hopelessly out of date. If you get the time feel free to open a new issue.

@iconara iconara closed this as completed Mar 1, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants