[issue33674] asyncio: race condition in SSLProtocol

STINNER Victor report at bugs.python.org
Mon May 28 16:59:47 EDT 2018


STINNER Victor <vstinner at redhat.com> added the comment:

Yury Selivanov told me that usually it's safer to add call_soon(), than to remove call_soon(). But adding many call_soon() can make asyncio SSL slower.

SSLProtocol doesn't seem to like call_soon(), it's only used at:

* connection_lost(): call_soon(self._app_protocol.connection_lost, exc)
* connection_made() ~~> call_soon(self._process_write_backlog)
* _on_handshake_complete(): call_soon(self._process_write_backlog)

That's all. All other operations are done immediately.

_on_handshake_complete() contains a long comment:

        # In case transport.write() was already called. Don't call
        # immediately _process_write_backlog(), but schedule it:
        # _on_handshake_complete() can be called indirectly from
        # _process_write_backlog(), and _process_write_backlog() is not
        # reentrant.
        self._loop.call_soon(self._process_write_backlog)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33674>
_______________________________________


More information about the Python-bugs-list mailing list