Message395377
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. |
|
Date |
User |
Action |
Args |
2021-06-09 02:44:42 | duaneg | set | recipients:
+ duaneg, paul.moore, tim.golden, zach.ware, steve.dower, dhamilton, ph.fieschi |
2021-06-09 02:44:42 | duaneg | set | messageid: <1623206682.6.0.478952178329.issue39345@roundup.psfhosted.org> |
2021-06-09 02:44:42 | duaneg | link | issue39345 messages |
2021-06-09 02:44:42 | duaneg | create | |
|