Exception in callback _UnixReadPipeTransport._call_connection_lost()
handle: <Handle _UnixReadPipeTransport._call_connection_lost()>
Traceback (most recent call last):
File "asyncio/events.py", line 89, in _run
self._context.run(self._callback, *self._args)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "asyncio/unix_events.py", line 631, in _call_connection_lost
self._protocol.connection_lost(exc)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^
File "asyncio/base_subprocess.py", line 305, in connection_lost
self.proc._pipe_connection_lost(self.fd, exc)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
File "asyncio/base_subprocess.py", line 227, in _pipe_connection_lost
self._try_finish()
~~~~~~~~~~~~~~~~^^
File "asyncio/base_subprocess.py", line 269, in _try_finish
waiter.set_result(self._returncode)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
asyncio.exceptions.InvalidStateError: invalid state
Immediately cancelling a subprocess_exec() task in next loop iteration shouldn't cause a InvalidStateError at the very least.
I will verify this, and tentatively disable this AIO test until it's fixed upstream.
python/cpython#103847 seems to be an issue that is not yet fully fixed, while this test_cancel_post_init test does exist in upstream, let me see why it didn't flake like it is reported here.
Ahh it's the unhandled exception check thing, it's covering all tests in uvloop, but only some in cpython repo. Let me at least propose for the SubprocessMixin to check unhandled exceptions, and skip this test in uvloop for now.
Activity
fantix commented on Jan 11, 2026
Based on the test code and traceback, this is likely a CPython asyncio issue:
Exception in callback _UnixReadPipeTransport._call_connection_lost() handle: <Handle _UnixReadPipeTransport._call_connection_lost()> Traceback (most recent call last): File "asyncio/events.py", line 89, in _run self._context.run(self._callback, *self._args) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "asyncio/unix_events.py", line 631, in _call_connection_lost self._protocol.connection_lost(exc) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^ File "asyncio/base_subprocess.py", line 305, in connection_lost self.proc._pipe_connection_lost(self.fd, exc) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^ File "asyncio/base_subprocess.py", line 227, in _pipe_connection_lost self._try_finish() ~~~~~~~~~~~~~~~~^^ File "asyncio/base_subprocess.py", line 269, in _try_finish waiter.set_result(self._returncode) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^ asyncio.exceptions.InvalidStateError: invalid stateImmediately cancelling a subprocess_exec() task in next loop iteration shouldn't cause a InvalidStateError at the very least.
I will verify this, and tentatively disable this AIO test until it's fixed upstream.
fantix commented on Jan 11, 2026
Confirmed that this issue is introduced in python/cpython#140805
fantix commented on Jan 11, 2026
python/cpython#103847 seems to be an issue that is not yet fully fixed, while this test_cancel_post_init test does exist in upstream, let me see why it didn't flake like it is reported here.
fantix commented on Jan 12, 2026
Ahh it's the unhandled exception check thing, it's covering all tests in uvloop, but only some in cpython repo. Let me at least propose for the SubprocessMixin to check unhandled exceptions, and skip this test in uvloop for now.
uvloop 0.23.0