Message350181
| Author |
vstinner |
| Recipients |
eryksun, jeremy.kloth, jkloth, nanjekyejoannah, vstinner |
| Date |
2019年08月22日.10:44:50 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1566470690.43.0.843884962339.issue37531@roundup.psfhosted.org> |
| In-reply-to |
| Content |
Oh, I found an issue with regrtest and Windows processes.
On Windows, when a process dies (crash or whatever), Popen.communicate() continues to hang in the parent if the died process has at least one child process which is still alive.
Test attached kill_timeout.py:
---
vstinner@WIN C:\vstinner\python\master>python x.py
Running Debug|x64 interpreter...
parent pid 1600
child1 pid 2184
child2 pid 4516
communicate(): timeout (1)
child1 killed
wait() returned: returncode 1
communicate() timeout (2)
---
Calling Popen.communicate() hangs even if the child process has been killed, whereas wait() completes immediately.
On Windows, Popen.communicate() is implemented with threads calling this function on each pipe:
def _readerthread(self, fh, buffer):
buffer.append(fh.read())
fh.close()
It seems like self.stdout.read() hangs even after the child process has been killed. |
|