-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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
asyncio sock_recv blocks on ssl sockets. #81585
Comments
I'm working on a server that uses sock_recv from asyncio. |
You can't use sock_recv() with a wrapped SSL socket. A SSLSocket behaves differently because there is user-level buffering. The connection operates on TLS frames and only hands off data after it has been decrypted and verified. asyncio uses wrap_bio(). |
Can you please elaborate on how to get around this issue? |
Use asyncio transports or streams. wrapped ssl socket provides a synchronous interface only. Perhaps we should raise an exception if SSLSocket is passed into asyncio functions. |
Ah, I see. Yes, raising an exception would probably be very useful. Thanks for the info. |
Fixed this issue since the CLA of the past user wasn't signed. Added a check for the socket type in each of the methods: PR: #60661 |
The patch broke Python builds without ssl support and caused a minor performance regression in hot paths. I changed the code to only perform the check in debug mode. |
Sorry it broke the version, what could I have done to avoid this? |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: