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
Errno::ENOPROTOOPT when connecting to Redis with JRuby-9.2.14.0 #6541
Comments
hey @ThomasKoppensteiner thanks for the report, based on this condition https://github.com/redis/redis-rb/blob/f7d354fd1f7069ccf5e7392d3bb83f48d9bf8545/lib/redis/connection/ruby.rb#L315 tcp_keepalive should be skipped on Darwin? So I expect you were testing on a Linux environment? here's the full story in 9.2.14.0, after jnr-constants update, they're available, but a simplified script
the good part is it works on master. I think that @headius 's work on TCP_CORK support also fixed this issue, but it wasn't backported back to 9.2.x |
@ahorek thank you for reply.
I don't see why this should be skipped on Darwin/macOS?
True, with
Any plans to backport this to |
We have backported bits and pieces but I am not sure how much effort is required to backport everything needed for this issue. I have merged #6542 which improves the situation for 9.3, and we hope to get that released within the next month. Perhaps you could test out a snapshot build of 9.3 and see if it works correctly for you? It would help us confirm that we at least have the right fixes in place. |
@ThomasKoppensteiner it would be great if you could test it out on 9.3. |
@ahorek yes the |
I tested the ~/Downloads/jruby-head/bin/ruby --version && ~/Downloads/jruby-head/bin/ruby ./connect_to_redis.rb
jruby 9.3.0.0-SNAPSHOT (2.6.5) 2021-01-29 7b9f596d4c Java HotSpot(TM) 64-Bit Server VM 25.192-b12 on 1.8.0_192-b12 [darwin-x86_64]
Connection without TCP keepalive...
Value fetched: bar1
---
Connection with TCP keepalive...
Value fetched: bar2 |
I get different errors for the "simplified script" from above for each JRuby version. I'm not sure which ones are expected. require 'socket'
@sock = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0)
@sock.setsockopt(Socket::SOL_TCP, Socket::TCP_KEEPIDLE, 1) 9.2.13.0 ruby --version && ruby ./socket_test.rb
jruby 9.2.13.0 (2.5.7) 2020-08-03 9a89c94bcc Java HotSpot(TM) 64-Bit Server VM 25.192-b12 on 1.8.0_192-b12 [darwin-x86_64]
NameError: uninitialized constant Socket::TCP_KEEPIDLE
Did you mean? Socket::TCP_KEEPALIVE
const_missing at org/jruby/RubyModule.java:3760
<main> at ./socket_test.rb:6 9.2.14.0 ruby --version && ruby ./socket_test.rb
jruby 9.2.14.0 (2.5.7) 2020-12-08 ebe64bafb9 Java HotSpot(TM) 64-Bit Server VM 25.192-b12 on 1.8.0_192-b12 [darwin-x86_64]
Errno::ENOPROTOOPT: Protocol not available - Protocol not available
setsockopt at org/jruby/ext/socket/RubyBasicSocket.java:327
<main> at ./socket_test.rb:6 9.3.0.0-SNAPSHOT ~/Downloads/jruby-head/bin/ruby --version && ~/Downloads/jruby-head/bin/ruby ./socket_test.rb
jruby 9.3.0.0-SNAPSHOT (2.6.5) 2021-01-29 7b9f596d4c Java HotSpot(TM) 64-Bit Server VM 25.192-b12 on 1.8.0_192-b12 [darwin-x86_64]
NameError: uninitialized constant Socket::SOL_TCP
Did you mean? Socket::SO_TYPE
const_missing at org/jruby/RubyModule.java:3899
<main> at ./socket_test.rb:6 |
|
FYI we are debating the level of effort to get the 9.3 socket improvements backported to 9.2, since we will continue to maintain 9.2 until a substantial plurality of users have migrated to 9.3. Worst case we could just copy all the socket code from |
Any plans regarding #6541 (comment) ? |
Just to amplify this: backporting the relevant fixes to 9.2 would be hugely appreciated 🙏 |
At the moment there is no 9.2.18 planned but I will put together a PR that basically just copies the socket code from master to 9.2. |
This is a wholesale duplication of the 9.3 (master at time of writing) socket implementation into 9.2 to pick up all recent improvements in the socket library. This should address jruby#6541 and other socket issues fixed on master.
I have pushed #6664 to address this. I did not bother trying to maintain commit history. All future changes to socket should happen on master (at least until 9.3 branch has been created and we abandon 9.2 updates). |
@headius huge thanks for that PR!
Just to understand that a bit better, does it foreclose the possibility of a 9.2.18.0, or does it just mean the release date isn't scheduled at this point? |
@acrewdson It just means we have not scheduled it and are trying to get 9.3 out the door. We will continue to maintain 9.2 (including releasing 9.2.18) for at least the six months following the 9.3 release. |
@headius got it – thank you! |
The socket updates have been backported and JRuby 9.2 should largely match 9.3/master functionality now.
|
@headius huge thanks 🙇 |
@headius any plans/timeline when JRuby 9.2.18.0 could be released? |
@aboltart We are trying to finish up 9.3 to get it out the door, so we are not planning a 9.2.18.0 right now. We will do a 9.2.18.0 once 9.3 is out, or if it looks like 9.3 will be delayed further. Anything you can do to help us validate and close out 9.3 issues will make this process go faster! 😀 |
@aboltart Actually we just had a chat about this and given some upcoming delays due to summer vacations we will do a 9.2.18.0 very soon. |
Connecting to Redis with
tcp_keepalive
option set raises anErrno::ENOPROTOOPT
error inJRuby-9.2.14.0
. It works inJRuby-9.2.13.0
. I think this is because this PR removedSOL
constants fromRubyBasicSocket
, but didn't add it toRubyTCPSocket
(and others).Example
JRuby-9.2.13.0 Output
JRuby-9.2.14.0 Output
Environment Information
9.2.13.0
vs.9.2.14.0
The text was updated successfully, but these errors were encountered: