Wait for readability when an SSL write requests it - #70
Open
OskarEichler wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Handle :wait_readable from write_nonblock(exception: false), wait with write_timeout, and raise Net::WriteTimeout if readiness is not reached. The current case statement retries that result immediately without any wait or timeout.
Reproduction
OpenSSL::Buffering#write_nonblock documents both readiness directions, including :wait_readable with exception: false.
Bounded deterministic IO doubles also cover timeout without a retry, partial writes, multiple strings, alternating readiness directions, preserved output and the timeout's IO reference.
Verification
6cba9756b72eaa5a939b4cb6e032ec1da88b07bd.bundle exec rake test: 30 tests, 66 assertions, zero failures/errors on the baseline and this branch.git diff --checkpass. Supplemental RuboCop Lint has the same 11 pre-existing offenses; no lint-clean claim.Compatibility and limitations
No signature changes. A write waiting for read readiness now honors write_timeout instead of busy-retrying. Validation exercises the documented IO contract; it does not claim a reproduced live TLS renegotiation or cross-platform TLS test.
The patch also applies to installed release 0.3.0, whose runtime file matches the reviewed master. Gem version, dependencies and Ruby >= 2.6 requirement stay unchanged. Only macOS/Ruby 4.0.6 was run locally; other Ruby/OS combinations require upstream CI. No production traffic or external service was used.