Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot connect to RabbitMQ on JRuby 9.0.1.0 due to private method call Bunny::SocketImpl#open #356

Closed
naag opened this issue Oct 8, 2015 · 6 comments
Assignees

Comments

@naag
Copy link

naag commented Oct 8, 2015

I've just opened PR #355 to fix a issue where Bunny swallows a NoMethodError. This is kind of a companion issue where I try to to report the root issue.

When running on JRuby 9.0.1.0 (other versions should be affected as well), Bunny cannot connect to RabbitMQ at all:

$ ruby -e 'require "bunny"; Bunny.new.start'
W, [2015-10-08T10:18:49.731000 #13626]  WARN -- #<Bunny::Session:0xfa4 guest@127.0.0.1:5672, vhost=/, addresses=[127.0.0.1:5672]>: Could not establish TCP connection to 127.0.0.1:5672: 
Bunny::TCPConnectionFailedForAllHosts: Could not establish TCP connection to any of the configured hosts
  start at /home/buecker/.rvm/gems/jruby-9.0.1.0/gems/bunny-2.2.0/lib/bunny/session.rb:315
  <top> at -e:1

As you can see in my PR, the real issue behind this is a NoMethodError due to the way that Bunny::SocketImpl#open works on JRuby (https://github.com/ruby-amqp/bunny/blob/master/lib/bunny/transport.rb#L279). This never happens on MRI because the modules are setup differently. I can't really explain it better, but the generous folks over at JRuby looked at this as well, maybe you want to checkout the conversation we had on IRC: http://logs.jruby.org/jruby/2015-10-07#14240751. Quoting:

21:50 <enebo> oh heh 
21:50 <enebo> cruby socket has self.open and jruby does not 
21:50 <headius> it will work in MRI because open is defined directly on Bunny::Socket 
21:50 <enebo> yeah 
21:51 <headius> enebo: right, but Bunny::JRuby::Socket includes Bunny::Socket 
21:51 <headius> but that doesn't pull in class methods 

I hope this makes sense to you and there's a way to improve this. If you need anything else, I'd be happy to help out!

@michaelklishin
Copy link
Member

Thank you but JRuby is no longer supported.
I'm happy to include your PR but don't count on JRuby support for the future. Simply use March Hare.

On 8 oct 2015, at 11:55, naag notifications@github.com wrote:

I've just opened PR #355 to fix a issue where Bunny swallows a NoMethodError. This is kind of a companion issue where I try to to report the root issue.

When running on JRuby 9.0.1.0 (other versions should be affected as well), Bunny cannot connect to RabbitMQ at all:

$ ruby -e 'require "bunny"; Bunny.new.start'
W, [2015-10-08T10:18:49.731000 #13626] WARN -- #<Bunny::Session:0xfa4 guest@127.0.0.1:5672, vhost=/, addresses=[127.0.0.1:5672]>: Could not establish TCP connection to 127.0.0.1:5672:
Bunny::TCPConnectionFailedForAllHosts: Could not establish TCP connection to any of the configured hosts
start at /home/buecker/.rvm/gems/jruby-9.0.1.0/gems/bunny-2.2.0/lib/bunny/session.rb:315
at -e:1
As you can see in my PR, the real issue behind this is a NoMethodError due to the way that Bunny::SocketImpl#open works on JRuby (https://github.com/ruby-amqp/bunny/blob/master/lib/bunny/transport.rb#L279). This never happens on MRI because the modules are setup differently. I can't really explain it better, but the generous folks over at JRuby looked at this as well, maybe you want to checkout the conversation we had on IRC: http://logs.jruby.org/jruby/2015-10-07#14240751. Quoting:

21:50 oh heh
21:50 cruby socket has self.open and jruby does not
21:50 it will work in MRI because open is defined directly on Bunny::Socket
21:50 yeah
21:51 enebo: right, but Bunny::JRuby::Socket includes Bunny::Socket
21:51 but that doesn't pull in class methods
I hope this makes sense to you and there's a way to improve this. If you need anything else, I'd be happy to help out!


Reply to this email directly or view it on GitHub.

@naag
Copy link
Author

naag commented Oct 8, 2015

Thanks for the super fast feedback. I totally get your point. Would you still be interested in an additional PR to change the Bunny::SocketImpl behaviour to work again on JRuby? Some folks might still like to use Bunny to be able to switch back and forth between MRI and JRuby :-)

@michaelklishin
Copy link
Member

@naag sure. Just don't bet your kingdom on Bunny working well on JRuby in the future :) We obviously want it to work decently but March Hare has a nearly identical API and supporting JRuby prior to 9000 was fairy time consuming.

@michaelklishin
Copy link
Member

Fixed by #355. @naag may I ask you to submit a PR that updates change log and credit yourself?

@michaelklishin michaelklishin self-assigned this Oct 8, 2015
@naag
Copy link
Author

naag commented Oct 8, 2015

Having almost the same API for March Hare and Bunny is definitely a great thing. I'll still try to fix it for JRuby and also update the changelog. Thanks for the support!

@michaelklishin
Copy link
Member

@naag thank you, looking forward to a PR that makes JRuby useable again :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants