[New-bugs-announce] [issue41539] print blocks with multiprocessing and buffered output

Martin report at bugs.python.org
Thu Aug 13 05:42:10 EDT 2020


New submission from Martin <martin.schroeder at nerdluecht.de>:

I experience a problem with multiprocessing and print.

I tried to make a minimal working example, please see the attached file.

WITHOUT the offending print statement in the queue filler thread, everything works:
- pytest experiments/mp_problem.py
- pytest experiments/mp_problem.py -s
- python experiments/mp_problem.py

WITH the offending print statement, not so much:
- pytest experiments/mp_problem.py WORKS (Probably because pytest captures fd 1)
- pytest experiments/mp_problem.py -s FAILS eventually (after a couple of workers have been started)
- python experiments/mp_problem.py FAILS eventually (same).

WITH the offending print statement AND PYTHONUNBUFFERED=1, everything works again:
- pytest experiments/mp_problem.py
- pytest experiments/mp_problem.py -s
- python experiments/mp_problem.py

Environment:
Ubuntu 18.04.5 LTS
python 3.8.5 (hcff3b4d_1) on conda 4.8.3

----------
files: mp_problem.py
messages: 375298
nosy: moi90
priority: normal
severity: normal
status: open
title: print blocks with multiprocessing and buffered output
type: behavior
versions: Python 3.8
Added file: https://bugs.python.org/file49385/mp_problem.py

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


More information about the New-bugs-announce mailing list