[Python-checkins] bpo-33674: asyncio: Fix SSLProtocol race (GH-7175) (GH-7188)
Yury Selivanov
webhook-mailer at python.org
Tue May 29 00:46:53 EDT 2018
https://github.com/python/cpython/commit/7593b8a5075ff45d71be9f62980be6a9c005afa9
commit: 7593b8a5075ff45d71be9f62980be6a9c005afa9
branch: 3.6
author: Victor Stinner <vstinner at redhat.com>
committer: Yury Selivanov <yury at magic.io>
date: 2018-05-29T00:46:48-04:00
summary:
bpo-33674: asyncio: Fix SSLProtocol race (GH-7175) (GH-7188)
Fix a race condition in SSLProtocol.connection_made() of
asyncio.sslproto: start immediately the handshake instead of using
call_soon(). Previously, data_received() could be called before the
handshake started, causing the handshake to hang or fail.
(cherry picked from commit be00a5583a2cb696335c527b921d1868266a42c6)
files:
A Misc/NEWS.d/next/Library/2018-05-28-22-49-59.bpo-33674.6LFFj7.rst
M Lib/asyncio/sslproto.py
diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py
index a82babb6b9e2..367f7d07a418 100644
--- a/Lib/asyncio/sslproto.py
+++ b/Lib/asyncio/sslproto.py
@@ -574,7 +574,7 @@ def _start_handshake(self):
# (b'', 1) is a special value in _process_write_backlog() to do
# the SSL handshake
self._write_backlog.append((b'', 1))
- self._loop.call_soon(self._process_write_backlog)
+ self._process_write_backlog()
def _on_handshake_complete(self, handshake_exc):
self._in_handshake = False
diff --git a/Misc/NEWS.d/next/Library/2018-05-28-22-49-59.bpo-33674.6LFFj7.rst b/Misc/NEWS.d/next/Library/2018-05-28-22-49-59.bpo-33674.6LFFj7.rst
new file mode 100644
index 000000000000..1e9868073f78
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2018-05-28-22-49-59.bpo-33674.6LFFj7.rst
@@ -0,0 +1,4 @@
+Fix a race condition in SSLProtocol.connection_made() of asyncio.sslproto:
+start immediately the handshake instead of using call_soon(). Previously,
+data_received() could be called before the handshake started, causing the
+handshake to hang or fail.
More information about the Python-checkins
mailing list