Setting SO_LINGER completely inconsistent #4040

Closed
etehtsea opened this Issue Jul 29, 2016 · 4 comments

Projects

None yet

3 participants

@etehtsea
Contributor
etehtsea commented Jul 29, 2016 edited

MRI works / JRuby unsupported:
s.setsockopt(Socket::Option.linger(true, 0))


MRI works / JRuby accepted, but does nothing (broken):

require 'socket'; s = Socket.tcp('localhost', 6379); s.setsockopt(Socket::SOL_SOCKET, Socket::SO_LINGER, [1,0].pack('ii')); s.close

MRI:

17358   7700.821842 127.0.0.1   127.0.0.1   TCP 44  62123 → 6379 [RST, ACK] Seq=1 Ack=1 Win=408288 Len=0

JRuby:

17291   7541.692073 127.0.0.1   127.0.0.1   TCP 56  62096 → 6379 [FIN, ACK] Seq=1 Ack=1 Win=408288 Len=0 TSval=457027447 TSecr=457027443
17292   7541.692126 127.0.0.1   127.0.0.1   TCP 56  6379 → 62096 [ACK] Seq=1 Ack=2 Win=408288 Len=0 TSval=457027447 TSecr=457027447
17293   7541.692133 127.0.0.1   127.0.0.1   TCP 56  [TCP Dup ACK 17289#1] 62096 → 6379 [ACK] Seq=2 Ack=1 Win=408288 Len=0 TSval=457027447 TSecr=457027447
17294   7541.692164 127.0.0.1   127.0.0.1   TCP 56  6379 → 62096 [FIN, ACK] Seq=1 Ack=2 Win=408288 Len=0 TSval=457027447 TSecr=457027447
17295   7541.692252 127.0.0.1   127.0.0.1   TCP 56  62096 → 6379 [ACK] Seq=2 Ack=2 Win=408288 Len=0 TSval=457027447 TSecr=457027447

MRI unsupported / JRuby broken:

MRI:

[7] pry(main)> require 'socket'; s = Socket.tcp('localhost', 6379); s.setsockopt(Socket::SOL_SOCKET, Socket::SO_LINGER, 0); s.close
Errno::EINVAL: Invalid argument - setsockopt(2)
from (pry):7:in `setsockopt'

JRuby same as previous.


MRI unsupported / JRuby actually works:

require 'socket'; s = Socket.tcp('localhost', 6379); s.setsockopt(Socket::SOL_SOCKET, :LINGER, 0); s.close

MRI same as previous.

JRuby:

require 'socket'; s = Socket.tcp('localhost', 6379); s.setsockopt(Socket::SOL_SOCKET, :LINGER, 0); s.close
=> nil
17553   8085.477203 127.0.0.1   127.0.0.1   TCP 44  62165 → 6379 [RST, ACK] Seq=1 Ack=1 Win=408288 Len=0
@headius
Member
headius commented Aug 24, 2016

@etehtsea This is fixed now, right?

@headius headius added this to the JRuby 9.1.3.0 milestone Aug 24, 2016
@etehtsea
Contributor
etehtsea commented Aug 25, 2016 edited

@headius nope. Even in #4093
If you want this in 9.1.3.0 it's possible to get some Socket::Option related commits from #4093 and fix this upon them. There was preparation PR #4074

@etehtsea etehtsea added a commit to etehtsea/jruby that referenced this issue Aug 27, 2016
@etehtsea etehtsea Properly handle SO_LINGER set/get sockopt
Fixes #4040
dc84237
@etehtsea
Contributor

@headius I've prepared PR #4119 that fixes this issue.

@etehtsea etehtsea added a commit to etehtsea/jruby that referenced this issue Aug 28, 2016
@etehtsea etehtsea Properly handle SO_LINGER set/get sockopt
Fixes #4040
62477f2
@etehtsea etehtsea added a commit to etehtsea/jruby that referenced this issue Aug 28, 2016
@etehtsea etehtsea Properly handle SO_LINGER set/get sockopt
Fixes #4040
da90e88
@enebo enebo modified the milestone: JRuby 9.1.4.0, JRuby 9.1.3.0 Aug 29, 2016
@enebo
Member
enebo commented Aug 29, 2016

@etehtsea we will try and get the branch you and @headius have been working on landed early in 9.1.4.0 but it will miss 9.1.3.0

@etehtsea etehtsea added a commit to etehtsea/jruby that referenced this issue Aug 31, 2016
@etehtsea etehtsea Properly handle SO_LINGER set/get sockopt
Fixes #4040
5091cef
@etehtsea etehtsea added a commit to etehtsea/jruby that referenced this issue Sep 7, 2016
@etehtsea etehtsea Properly handle SO_LINGER set/get sockopt
Fixes #4040
8cc3ddb
@etehtsea etehtsea added a commit to etehtsea/jruby that referenced this issue Sep 12, 2016
@etehtsea etehtsea Properly handle SO_LINGER set/get sockopt
Fixes #4040
d0cec64
@headius headius closed this in 1902354 Sep 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment