New submission from STINNER Victor <vstin...@python.org>:
Problem. When regrtest is interrupted by CTRL+c and regrtest multiprocessing code (-jN command line option) is used, regrtest randomly fails to stop come TestWorkerProcess threads. The problem is that only the direct child process is kill by SIGKILL. If the test spawns a grandchild process, this one will not be killed. Moreover, the grandchild process inherits the child process stdout and stderr. But regrtest mltiprocessing uses pipes for the child process stdout and stderr. At the end, Popen.communicate() hangs randomly in the main regrtest process (in a TestWorkerProcess thread) until the child process *and* the grandchild process completes. Except that the main regrtest does not directly kill the grandchild process. => see bpo-38207 Solution. I propose to: (1) use Popen() with start_new_session=True: a worker process calls setsid() to create a new process group. (2) Don't kill worker processes, but kill the process groups of worker processes. Attached PR implements this solution. ---------- components: Tests messages: 354818 nosy: vstinner priority: normal severity: normal status: open title: regrtest: use process groups versions: Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue38502> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com