Open dwbutler opened 10 years ago
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)
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 tonil
here and then passes thenil
port along toEM.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!