Fix HTTPS pooled client crash on unexpected SSL EOF (#3307)#3316
Open
Felix-Gong wants to merge 1 commit into
Open
Fix HTTPS pooled client crash on unexpected SSL EOF (#3307)#3316Felix-Gong wants to merge 1 commit into
Felix-Gong wants to merge 1 commit into
Conversation
wwbmmm
reviewed
May 30, 2026
| BIO_fd_non_fatal_error(saved_errno) != 0 || | ||
| nr < 0; | ||
| PLOG_IF(WARNING, is_fatal_error) << "Fail to read from ssl_fd=" << fd(); | ||
| if (is_fatal_error) { |
Contributor
Author
There was a problem hiding this comment.
This branch is changing errno from saved_errno to ESSL, which is a minor semantic improvement but not a bug fix.
Contributor
There was a problem hiding this comment.
If you change this behavior, you'd better check the callers' code and make sure they don't depend on the value of errno.
When OpenSSL 3.x detects unexpected EOF (peer closed without close_notify), SSL_read returns 0 with SSL_ERROR_SSL. The code didn't return -1, causing error_code=0 to propagate to Controller::SetFailed() which triggers CHECK(false). Fix by returning -1 with errno=ESSL when SSL errors are detected in DoRead(), instead of falling through and returning nr. Discovered during RISC-V porting and integration testing. Fixes apache#3307 Signed-off-by: Felix Gong <gongxiaofei24@iscas.ac.cn>
9b8eff6 to
f11c336
Compare
Contributor
|
BTW, Can you add some unit tests to verify this fix? |
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
Root Cause
When OpenSSL 3.x detects unexpected EOF (peer closed without close_notify), SSL_read returns 0 with SSL_ERROR_SSL. The code didn't return -1, causing error_code=0 to propagate to Controller::SetFailed() which triggers CHECK(false).
Fix
In the default branch of DoRead(), return -1 with errno=ESSL when SSL errors are detected, instead of falling through and returning nr.
Fixes #3307