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 duaneg
Recipients dhamilton, duaneg, paul.moore, ph.fieschi, steve.dower, tim.golden, zach.ware
Date 2021-06-09.02:44:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1623206682.6.0.478952178329.issue39345@roundup.psfhosted.org>
In-reply-to
Content
I can reproduce this on Windows 10 with Python 3.9. See attached source. At least for us, it is hanging when one thread is doing a read on the file descriptor while a second calls Py_Initialize (or just dup directly).

The windows kernel call stack shows the dup call is waiting on a critical section, while the thread reading from stdin is waiting in ReadFile. I can get a full stack trace from WinDbg if it is helpful, but hopefully the attached code should be enough to reproduce the problem at will for anyone interested.

If stdin is receiving input, or is closed, then the read call will complete and unblock dup in due course. However if not then it will hang indefinitely.

If we can fix this to work reliably in Python that would be great. Otherwise, or in the meantime, we could just add a note to the documentation. We are going to try and work-around it by using a different file descriptor instead of stdin. Other applications might be able to avoid IO using stdin until after python is initialised.
History
Date User Action Args
2021-06-09 02:44:42duanegsetrecipients: + duaneg, paul.moore, tim.golden, zach.ware, steve.dower, dhamilton, ph.fieschi
2021-06-09 02:44:42duanegsetmessageid: <1623206682.6.0.478952178329.issue39345@roundup.psfhosted.org>
2021-06-09 02:44:42duaneglinkissue39345 messages
2021-06-09 02:44:42duanegcreate