GH-85760: Fix race in calling process_exited callback too early (#97009)

This commit is contained in:
Kumar Aditya 2022-09-22 22:13:47 +05:30 committed by GitHub
parent 24e0379624
commit 282edd7b2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -223,7 +223,8 @@ class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop):
return transp
def _child_watcher_callback(self, pid, returncode, transp):
self.call_soon_threadsafe(transp._process_exited, returncode)
# Skip one iteration for callbacks to be executed
self.call_soon_threadsafe(self.call_soon, transp._process_exited, returncode)
async def create_unix_connection(
self, protocol_factory, path=None, *,

View File

@ -0,0 +1 @@
Fix race condition in :mod:`asyncio` where :meth:`~asyncio.SubprocessProtocol.process_exited` called before the :meth:`~asyncio.SubprocessProtocol.pipe_data_received` leading to inconsistent output. Patch by Kumar Aditya.