Repository navigation
asyncio.subprocess blocked event loop unexpectedly on MacOS #158287
Description
Activity
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Sep 27, 2026 - addedstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
on Sep 27, 2026 @starstreammm Do you mean that on Python 3.14.6 it works well? or is it on 3.13 that it works well? (this is to confirm whether it's a release blocker or not)
@starstreammm Do you mean that on Python 3.14.6 it works well? or is it on 3.13 that it works well? (this is to confirm whether it's a release blocker or not)
I updated my Python version yesterday. It had been quite a while since my last update, but I can confirm that I was already using 3.14 after the update. This issue didn't happen on that version. But I don't remember which version I used before exactly.
Reacted by Bénédikt TranI'm going to let Kumar have a look at this issue and decide whether this is a release-blocker. At least, it's a regression AFAICT.
hey, i just took a quick look with my own tooling (on macos too)
The trace:
[EventLoopBlock] 'main' blocked the loop for 0.735s (threshold: 0.1s) Stack at the moment of blocking: File "/Users/timofeiivankov/cpython/repro.py", line 199, in <module> asyncio.run(main()) File "/Users/timofeiivankov/cpython/Lib/asyncio/runners.py", line 205, in run return runner.run(main) File "/Users/timofeiivankov/cpython/Lib/asyncio/runners.py", line 128, in run return self._loop.run_until_complete(task) File "/Users/timofeiivankov/cpython/Lib/asyncio/base_events.py", line 712, in run_until_complete self.run_forever() File "/Users/timofeiivankov/cpython/Lib/asyncio/base_events.py", line 683, in run_forever self._run_once() File "/Users/timofeiivankov/cpython/Lib/asyncio/base_events.py", line 2090, in _run_once handle._run() File "/Users/timofeiivankov/cpython/Lib/asyncio/events.py", line 135, in _run return super()._run() File "/Users/timofeiivankov/cpython/Lib/asyncio/events.py", line 91, in _run self._context.run(self._callback, *self._args) File "/Users/timofeiivankov/cpython/Lib/asyncio/unix_events.py", line 1003, in _reap_and_notify pid, returncode = self._reap(loop, expected_pid) File "/Users/timofeiivankov/cpython/Lib/asyncio/unix_events.py", line 1008, in _reap pid, status = os.waitpid(expected_pid, 0) -> Culprit: _reap() at /Users/timofeiivankov/cpython/Lib/asyncio/unix_events.py:1008So
_reapis probably the cause, or the code near it. If no one objects, I can work on the PRCan you bisect the faulty commit first? @deadlovelll
Can you bisect the faulty commit first? @deadlovelll
Faulty commit - 2875d1d (#153810). Fix is needed for main, 3.15 and 3.14
Reacted by Bénédikt Tran- added3.14bugs and security fixesbugs and security fixes3.15bugs and security fixesbugs and security fixes3.16new features, bugs and security fixesnew features, bugs and security fixes
on Sep 27, 2026 This seems like a macos kernel bug to me, dotnet is also hitting this quirk in dotnet/runtime#133930
I think the fix is to exclude
CLD_STOPPEDmanually here to avoid blocking inwaitpid.- added 4 commits that reference this issue
on Oct 9, 2026
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsTodo
Bug report
Bug description:
After upgrading to 3.14.7 & macOS 27, this bug has happened.
When pausing the subprocess created by
asyncio.create_subprocess_exec, it will blocked the whole event loop on MacOS.Here is a minimal test code:
Expectly, it should print:
However, it just prints
child pid: xxxxx, without anyalive.This issue isn't caused by
psutilbecause the same result was got withkill -STOP xxxxx.This runs well on Windows, but not on MacOS. This didn't happen on the previous version of 3.14.
CPython versions tested on:
3.14
Operating systems tested on:
macOS, Windows
Linked PRs