Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

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

nerdrew opened this issue Feb 23, 2017 · 3 comments

Comments

@nerdrew
Copy link

@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
Copy link
Member

@headius 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
Copy link
Member

@headius 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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants
You can’t perform that action at this time.