[asyncio] bpo-29743: ssl socket leak during handshake#480
[asyncio] bpo-29743: ssl socket leak during handshake#4801st1 merged 3 commits intopython:masterfrom fafhrd91:ssl-handshake-cancel
Conversation
|
@fafhrd91, thanks for your PR! By analyzing the history of the files in this pull request, we identified @Haypo, @1st1, @serhiy-storchaka and @vadmium to be potential reviewers. |
Lib/asyncio/sslproto.py
Outdated
There was a problem hiding this comment.
Can the waiter here be in a resolved state without an exception set? I.e. is else clause possible here?
There was a problem hiding this comment.
2020 and I'm still seeing this issue when the site returns an invalid certificate. The handshake is aborted and the socket isn't released. I'm on Pyhton 3.6.8 with the latest asyncio and aiohttp.
|
I modified PR. I think aborting transport is better approach. i.e socket with uncompleted handshake is broken and we can not do anything, just drop. |
|
This is a much better version, I like it. |
|
Is this for bpo-29743? If so, please prefix the pull request description with it. Thanks :) |
This fixes asyncio issue python#480. The _SelectorDatagramTransport.sendto method has to be modified so _sock.send is used only if _sock is connected. It also protects socket.getsockname against OSError in _SelectorTransport. This might happen on Windows if the socket is not connected (e.g. for UDP broadcasting).
fixed ssl socket leak
python/asyncio#487
aio-libs/aiohttp#1679