STINNER Victor <vstin...@redhat.com> added the comment:

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.

----------
Added file: https://bugs.python.org/file48555/kill_timeout.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37531>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to