redis-rb icon indicating copy to clipboard operation
redis-rb copied to clipboard

Redis gem not able to create tcp keep alive connections on jruby

Open anubhav0712 opened this issue 5 years ago • 0 comments

I was trying to test the tcp keep alive functionality, using the following script.

require 'redis'

option = {
    :url => 'redis://localhost:6380',
    :tcp_keepalive => 60
}
conn = Redis.new(option)
puts "starting psubscribe...."
conn.psubscribe('some:key') do |on|
    on.pmessage do |pattern, channel, msg|
      puts "Do something!"
    end
end

And checked the connection information using netstat.

Initially, I ran this script on jruby 9.2.8.0. And saw the following output from netstat. image

But when I run the same script on ruby 2.5.1p57 . It worked fine image

Redis gem version is v3.2.1 . I even tried updating the gem to v4 but the result is same. So is there any other configuration i'm missing, that can make tcp_keepalive work for redis_client on jruby?

anubhav0712 avatar Sep 21 '20 04:09 anubhav0712