We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3a13bd5 commit 46e8f64Copy full SHA for 46e8f64
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
@@ -307,6 +307,9 @@ async def cleanup(self) -> None:
307
await site.stop()
308
309
if self._server: # If setup succeeded
310
+ # Yield to event loop to ensure incoming requests prior to stopping the sites
311
+ # have all started to be handled before we proceed to close idle connections.
312
+ await asyncio.sleep(0)
313
self._server.pre_shutdown()
314
await self.shutdown()
315
0 commit comments