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.
"Resource temporarily unavailable"
As a result I did similar fix as in 857b76f
@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.
Bump jnr-enxio and add regression test
@headius, updated. Needs new jnr-enxio snapshot with jnr/jnr-enxio#23 merged in.
Hope this time I fixed it right.