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

Configuring redis:// url without port defaults the port to.... zero? #27

Open
dwbutler opened this issue Feb 27, 2014 · 1 comment
Open

Comments

@dwbutler
Copy link

Hi,

We're using Faye::Redis running in Puma under JRuby. We had an issue for quite a while where Faye communication would just.... stop.

It turns out we were using a url like redis://host without specifying the default port (6379). After diving through the code, I found that em-hiredis defaults the port to nil here and then passes the nil port along to EM.connect.

Diving into Eventmachine, it appears that it calls to_i on the port here (at least in JRuby). This means that it is trying to connect to port 0, which doesn't make a lot of sense. Furthermore, there is no exception. It appears that em-hiredis simply blocks on IO until the Puma connection times out.

I'm not sure what the correct fix would be. My gut feeling is that em-hiredis should simply default the port to 6379. I also feel that Eventmachine shouldn't accept a nil port, because a missing port can't mean anything reasonable.

Thanks, let me know what you think!

@dwbutler
Copy link
Author

Some more context in case you want to reproduce... We're using Amazon's Elasticache hosted Redis. When I run the following, it just hangs forever.

require 'socket'
socket=TCPSocket.open('yourserverhere.0001.use1.cache.amazonaws.com', 0)

This might be a configuration issue. Normally I would expect to see something like this:

require 'socket'
socket=TCPSocket.open('127.0.0.1', 0)
# => Errno::ECONNREFUSED: Connection refused - connect(2)

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

1 participant