Affects Version/s: JRuby 1.5.3
Fix Version/s: JRuby 1.6.7
Environment:repros under os x 10.6.4 with 1.6.0_22 and centos 5.4 with 1.6.0_21
Number of attachments :
After doing a connect_nonblock then it appears that IO.select will always return immediately and indicate the socket is not writable, when it should instead block and eventually return that it is writable, assuming the connection succeeds.
Example below. Note that this does not appear to be a timing specific issue; the sleep 5 gives it plenty of time to connect, and the select does not wait for the timeout before returning. Presumably calling connect_nonblock again updates some state that was out of sync.
>> addrinfo = ::Socket::getaddrinfo(@host, @port).first
=> ["AF_INET", 80, "pz-in-f99.1e100.net", "188.8.131.52", 2, 2, 17]
>> @handle = ::Socket.new(addrinfo, ::Socket::SOCK_STREAM, 0)
>> sockaddr = ::Socket.sockaddr_in(addrinfo, addrinfo)
Errno::EINPROGRESS: Operation now in progress - Operation now in progress
from (irb):18:in `connect_nonblock'
>> t=Time.now; IO.select(nil, [ @handle ], nil, @timeout); puts Time.now-t
Errno::EISCONN: Socket is already connected - Socket is already connected
from (irb):21:in `connect_nonblock'
>> IO.select(nil, [ @handle ], nil, @timeout)
=> [, [#<Socket:0x417470d0>], ]
|Field||Original Value||New Value|
|Status||Open [ 1 ]||Resolved [ 5 ]|
|Assignee||Thomas E Enebo [ enebo ]||Charles Oliver Nutter [ headius ]|
|Fix Version/s||JRuby 1.6.7 [ 18315 ]|
|Resolution||Fixed [ 1 ]|
|Status||Resolved [ 5 ]||Closed [ 6 ]|