You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SSLSocket error conditions are not consistent with IO.
io.close followed by io.read can result in EBADF rather than IOError.
Without sync_close, io.close followed by io.read will hang. Even if the underlying IO is not closed, I don't think the SSLSocket instance should continue to work after being closed?
Reproduction:
#!/usr/bin/env rubyrequire'bundler/inline'gemfiledosource'https://rubygems.org'gem'localhost'endrequire'socket'require'openssl'require'localhost'defread_after_close(io)io.closeio.readendbeginclient,server=Socket.pair(:UNIX,:STREAM)read_after_close(client)rescue=>error
$stderr.putserror.full_messageendbeginauthority=Localhost::Authority.fetchclient,server=Socket.pair(:UNIX,:STREAM)ssl_server=OpenSSL::SSL::SSLSocket.new(server,authority.server_context)ssl_server.sync_close=truessl_client=OpenSSL::SSL::SSLSocket.new(client,authority.client_context)ssl_client.sync_close=true# If this is not set, `io.read` above will hang which is also a bit odd.Thread.new{ssl_server.accept}ssl_client.connectread_after_close(ssl_client)rescue=>error
$stderr.putserror.full_messageend
Is this something we can improve?
The text was updated successfully, but these errors were encountered:
ioquatix
changed the title
Consistenty - IOError vs EBADF?
Consistenty - IOError vs EBADF?
Sep 11, 2024
ioquatix
added a commit
to socketry/io-stream
that referenced
this issue
Sep 11, 2024
SSLSocket
error conditions are not consistent withIO
.io.close
followed byio.read
can result inEBADF
rather thanIOError
.sync_close
,io.close
followed byio.read
will hang. Even if the underlying IO is not closed, I don't think theSSLSocket
instance should continue to work after being closed?Reproduction:
Is this something we can improve?
The text was updated successfully, but these errors were encountered: