We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 509fb26 commit e0d9d3aCopy full SHA for e0d9d3a
CHANGES/8271.bugfix.rst
@@ -0,0 +1 @@
1
+Fixed a race condition with incoming connections during server shutdown -- by :user:`Dreamsorcerer`.
aiohttp/web_runner.py
@@ -299,6 +299,9 @@ async def cleanup(self) -> None:
299
await site.stop()
300
301
if self._server: # If setup succeeded
302
+ # Yield to event loop to ensure incoming requests prior to stopping the sites
303
+ # have all started to be handled before we proceed to close idle connections.
304
+ await asyncio.sleep(0)
305
self._server.pre_shutdown()
306
await self.shutdown()
307
0 commit comments