[New-bugs-announce] [issue43890] Deadlock when mixing event loops and subprocesses

Thomas Buhrmann report at bugs.python.org
Mon Apr 19 14:36:19 EDT 2021


New submission from Thomas Buhrmann <thomas.buehrmann at gmail.com>:

When mixing code that spawns subprocesses with code that creates event loops, Python appears to deadlock.

In the attached example, when WORKERS = 16 and ASYNC_WORKERS = 8, Python will sometimes (50% of the time?) deadlock, never exiting, with no exceptions raised. Oddly, if ASYNC_WORKERS is set to 0 or 16 (i.e., only subprocesses or only event loops), it runs reliably.

I tested this in an x86_64 Ubuntu 20.04.2 VM with Python 3.8.6. I was only able to reproduce it when the VM had more than one CPU, and I was unable to reproduce it on x86_64 MacOS.

----------
files: subprocess_asyncio_deadlock.py
messages: 391386
nosy: thomas
priority: normal
severity: normal
status: open
title: Deadlock when mixing event loops and subprocesses
type: behavior
versions: Python 3.8
Added file: https://bugs.python.org/file49967/subprocess_asyncio_deadlock.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43890>
_______________________________________


More information about the New-bugs-announce mailing list