This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author moi90
Recipients moi90
Date 2020-08-13.09:42:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1597311730.71.0.906884435677.issue41539@roundup.psfhosted.org>
In-reply-to
Content
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
History
Date User Action Args
2020-08-13 09:42:10moi90setrecipients: + moi90
2020-08-13 09:42:10moi90setmessageid: <1597311730.71.0.906884435677.issue41539@roundup.psfhosted.org>
2020-08-13 09:42:10moi90linkissue41539 messages
2020-08-13 09:42:10moi90create