New submission from Yury Selivanov <yseliva...@gmail.com>:
Server.wait_closed() currently does two checks: 1. if _sockets is None -- means that Server.close() was called 2. if self._waiters is None -- means that Server._wakeup() was called if (1) *or* (2) is true, wait_closed() just returns without waiting on anything. However, when Server.close() is called there might be still active transports serving requests. Server.wait_closed() should wait until all of them are detached, even if Server._sockets is already reset. So the below implementation: async def wait_closed(self): if self._sockets is None or self._waiters is None: return waiter = self._loop.create_future() self._waiters.append(waiter) await waiter should be changed to: async def wait_closed(self): if self._waiters is None: assert self._active_count == 0 return waiter = self._loop.create_future() self._waiters.append(waiter) await waiter ---------- components: asyncio messages: 318360 nosy: asvetlov, yselivanov priority: normal severity: normal status: open title: Server.wait_closed() doesn't always wait for its transports to fihish versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33727> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com