fix: BIO_set_retry_write when BIO_CTRL_FLUSH to allow writer returns WouldBlock on flush#118
Merged
kornelski merged 1 commit intocloudflare:masterfrom Jan 20, 2026
Merged
Conversation
…WouldBlock on flush
Collaborator
|
Does this require upstream boringssl to fix the status too? openssl/openssl@bcbc7d6 |
Contributor
Author
No. You can try if the test can pass. |
kornelski
approved these changes
Jan 20, 2026
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.
A fix for rust-openssl can be found at rust-openssl/rust-openssl#1922
This PR fixes a BIO_flush related issue. According to openssl doc(link):
BIO_flush(), because it can write data may return 0 or -1 indicating that the call should be retried later in a similar manner to BIO_write(). The BIO_should_retry() call should be used and appropriate action taken is the call fails.
We have to call BIO_set_retry_write on retriable_error like WouldBlock. Otherwise, when the flush returns WouldBlock, it will fail.
Since we usually wrap openssl with a TcpStream, there is no buffer inside and flush always returns Ok(()), this issue is not obvious. However, if users use a buffered io, the flush support will be essential.