IO#close_write seems to close the read side too for unix sockets #4500

Closed
nerdrew opened this Issue Feb 23, 2017 · 3 comments

Comments

Projects
None yet
3 participants
@nerdrew

nerdrew commented Feb 23, 2017

This works in MRI 2.3.3 and 2.4.0, but fails on jruby-9.1.7.0:

require "debug_socket"
DebugSocket.start("boom")
require "socket"
sock = UNIXSocket.new("boom")
sock.write("1")
sock.close_write
sock.read

jruby failure:

IOError: not opened for reading
from org/jruby/RubyIO.java:2992:in `read'

Travis failure (has all the jruby version info + platform info):
https://travis-ci.org/square/debug_socket/jobs/204702060

Test case: https://github.com/square/debug_socket/blob/a94f1c857b2626273eba9331dbc43d3d2ad0cf4e/spec/debug_socket_spec.rb#L29

@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius Feb 24, 2017

Member

Weird...the code in jnr-unixsocket looks right, calling shutdown with read or write as appropriate. Must be in JRuby, perhaps not seeing that the other half is open and calling close to shut the whole thing down.

Member

headius commented Feb 24, 2017

Weird...the code in jnr-unixsocket looks right, calling shutdown with read or write as appropriate. Must be in JRuby, perhaps not seeing that the other half is open and calling close to shut the whole thing down.

@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius Feb 24, 2017

Member

Thanks for the PR!

Member

headius commented Feb 24, 2017

Thanks for the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment