fix a race condition in ConnectionHandler.drain_writers (#5749)

This commit is contained in:
Maximilian Hils 2022-11-22 14:04:06 +01:00 committed by GitHub
parent e24f93e263
commit b9dc95cb8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -307,7 +307,7 @@ class ConnectionHandler(metaclass=abc.ABCMeta):
write buffers, so if we cannot write fast enough our own read buffers run full and the TCP recv stream is throttled.
"""
async with self._drain_lock:
for transport in self.transports.values():
for transport in list(self.transports.values()):
if transport.writer is not None:
try:
await transport.writer.drain()