-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
bpo-33734: asyncio/ssl: Fix AttributeError, increase default handshake timeout #7321
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
Conversation
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.
Perhaps the NEWS entry could be a little more explicit about what problem is being solved, otherwise LGTM for 3.7.
@ned-deily @asvetlov I've just pushed an update. Long story short, I started to write functional tests for SSL to test this PR and discovered that SSL errors do not propagate correctly. For example, the following code somehow works in the master branch: reader, writer = await asyncio.open_connection(
*addr,
ssl=client_sslctx,
server_hostname='',
loop=self.loop,
ssl_handshake_timeout=1.0)
# we will get to this line without an error even if
# SSL handshake failed and the connection is
# in a semi-closed state. o_O
print('HERE') The latest commit fixes these bugs and adds more SSL tests. My plan is to backport these changes to uvloop and release a new version today. Since uvloop is quite popular and people report its bugs (as @hynek's report today demonstrated) I expect that if there are any issues with my fixes we'll know about them in a few days. IMHO this should go into 3.7.0 and it's a shame that our SSL layer is so fragile at this point. I have a developer looking into rewriting SSL properly for Python 3.8: MagicStack/uvloop#158, so hopefully it's not for long. Please take another look at the PR. |
Since it seems it is a bug fix (and a serious one at that), there shouldn't be any question about 3.7. Anything merged up to the 3.7.0rc1 cutoff will be in 3.7.0 final. |
Yeah, it's just that I'm not 100% sure about |
Add functional tests
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.
LGTM
@1st1: Please replace |
Thanks @1st1 for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7. |
* Fix AttributeError (not all SSL exceptions have 'errno' attribute) * Increase default handshake timeout from 10 to 60 seconds * Make sure start_tls can be cancelled correctly * Make sure any error in SSLProtocol gets propagated (instead of just being logged) (cherry picked from commit 9602643) Co-authored-by: Yury Selivanov <yury@magic.io>
GH-7396 is a backport of this pull request to the 3.7 branch. |
* Fix AttributeError (not all SSL exceptions have 'errno' attribute) * Increase default handshake timeout from 10 to 60 seconds * Make sure start_tls can be cancelled correctly * Make sure any error in SSLProtocol gets propagated (instead of just being logged) (cherry picked from commit 9602643) Co-authored-by: Yury Selivanov <yury@magic.io>
https://bugs.python.org/issue33734