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
Rescue IO::WaitReadable instead of EAGAIN for blocking read #2121
Conversation
On Windows, `read_nonblock` raises `Errno::EWOULDBLOCK` if a blocking read would occur, which is a different value from `Errno::EAGAIN`. Both of these errors are extended by `IO::WaitReadable` which is Ruby's recommended exception class for retrying `read_nonblock`.
1bcddae
to
3304499
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so helpful, and the PR description is eloquent in explaining why this is useful. I hope this can get merged.
@MSP-Greg since windows is mentioned, thoughts? |
LGTM. The set of Thanks to @wjordan for this. Test suites tend to be written with 'good input' tests. Almost more important are 'bad input' tests, which are needed to make sure the app recovers correctly. Note that 'bad input' can be accidental or deliberate... |
Description
Rescue
IO::WaitReadable
instead ofEAGAIN
on calls toread_nonblock
when a blocking read would occur.On Windows,
read_nonblock
raisesErrno::EWOULDBLOCK
, which is a different value on this platform fromErrno::EAGAIN
. Both of these errors are extended byIO::WaitReadable
, which is Ruby's recommended exception class for retryingread_nonblock
.I've included a test
test_open_connection_wait_no_queue
which fails on windows without this PR applied.Your checklist for this pull request
[changelog skip]
the pull request title.[ci skip]
to the title of the PR.#issue
" to the PR description or my commit messages.