-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Server.wait_closed() doesn't always wait for its transports to fihish #77908
Comments
Server.wait_closed() currently does two checks:
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 |
I believe this is by design: the documentation says:
(That said, I haven't figured out what _waiters is here so I could be wrong.) |
I ran into this while working on an asyncio application using From the documentation, I expected the combination of Could there be a method for this? One suggestion would be:
I'm afraid I'm not familiar with low-level asyncio APIs like transports and |
Duplicate of #79033 |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: