Skip to content

SSLSocket#connect_nonblock raises WaitReadable in JRuby, WaitWritable in MRI #1716

Closed
@iconara

Description

@iconara

SSLSocket#connect_nonblock raises an error that is-a IO::WaitReadable in JRuby, but in MRI it is instead IO::WaitWritable:

require 'socket'
require 'openssl'

socket = OpenSSL::SSL::SSLSocket.new(Socket.new(:INET, :STREAM))

begin
  socket.connect_nonblock
rescue => e
  puts("#{RUBY_ENGINE} WaitReadable #{e.is_a?(IO::WaitReadable)}")
  puts("#{RUBY_ENGINE} WaitWritable #{e.is_a?(IO::WaitWritable)}")
end

running this shows the mismatch:

$ rvm use jruby-1.7.12,ruby-2.0.0-p353 do ruby bug.rb
jruby-1.7.12: jruby 1.7.12 (1.9.3p392) 2014-04-15 643e292 on Java HotSpot(TM) 64-Bit Server VM 1.8.0-b132 +indy [darwin-x86_64]
jruby WaitReadable true
jruby WaitWritable false
ruby-2.0.0-p353: ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-darwin12.5.0]
ruby WaitReadable false
ruby WaitWritable true

I'm not sure what's right here. To me a connect is a read, so WaitReadable does seem to be what I expect – but MRI is the reference implementation I guess.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions