Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
IO#ready? returns incorrect results #2388
From: http://jira.codehaus.org/browse/JRUBY-5617. Works JRuby 1.7.18 (with discrepancies), fails on JRuby 9000.
IO#ready? returns incorrect results on second and subsequent calls.
a) Write 100 bytes to a sender socket, issue flush, keep socket open
Expected results: 100 bytes are read in 4 consecutive reads
Sample code is attached. Compare JRuby behavior with 'standard' Ruby using this code.
Wasn't a hard fix; I re-ported the logic from MRI but where they used FIONREAD and ioctl to check for available buffered bytes, I had no response. The old implementation used select to accomplish the same thing, so I reinstated that behavior.
I also cleaned up much of io/wait and got the MRI tests running. We only fail two of them, and I'm pretty sure it's due to JVM/JDK abstractions we can't avoid.