Skip to content

Fix IO#syswrite. Fixes #3799#4123

Merged
headius merged 1 commit intojruby:masterfrom
etehtsea:gh-3799-syswrite-block
Nov 22, 2016
Merged

Fix IO#syswrite. Fixes #3799#4123
headius merged 1 commit intojruby:masterfrom
etehtsea:gh-3799-syswrite-block

Conversation

@etehtsea
Copy link
Contributor

As a result of debugging I found out that SystemCallError that happens during syswrite is actually "Resource temporarily unavailable" that corresponds to EAGAIN. So first idea of fix was to put select somewhere. Related fix for IO#sysread gave me hope that I'm moving in right direction.

As a result I did similar fix as in 857b76f

@headius
Copy link
Member

headius commented Sep 6, 2016

@etehtsea I do not see the equivalent logic in MRI's implementation, which makes me reluctant to include this. I think the actual problem may be that jnr-unixsocket is not properly doing a blocking write, or the UNIX socket is getting set non-blocking for some reason.

I think we should try to investigate from the bottom up and figure out why jnr-unixsocket's write is not blocking and handling EAGAIN the same way as the write call MRI makes.

@etehtsea etehtsea force-pushed the gh-3799-syswrite-block branch from ea714e8 to bfcec47 Compare November 16, 2016 15:11
@etehtsea
Copy link
Contributor Author

etehtsea commented Nov 16, 2016

@headius, updated. Needs new jnr-enxio snapshot with jnr/jnr-enxio#23 merged in.
Hope this time I fixed it right.

@etehtsea etehtsea changed the title IO#syswrite should always block. Fixes #3799 Fix IO#syswrite. Fixes #3799 Nov 16, 2016
@headius headius merged commit 723f2da into jruby:master Nov 22, 2016
@headius headius added this to the JRuby 9.1.7.0 milestone Nov 22, 2016
@etehtsea etehtsea deleted the gh-3799-syswrite-block branch November 22, 2016 05:32
@etehtsea etehtsea restored the gh-3799-syswrite-block branch November 22, 2016 05:32
@headius
Copy link
Member

headius commented Nov 22, 2016

Thank you!

@etehtsea etehtsea deleted the gh-3799-syswrite-block branch November 22, 2016 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants