[New-bugs-announce] [issue40550] Popen.terminate fails with ProcessLookupError under certain conditions
Alexander Overvoorde
report at bugs.python.org
Thu May 7 16:01:24 EDT 2020
New submission from Alexander Overvoorde <overv161 at gmail.com>:
The following program frequently raises a ProcessLookupError exception when calling proc.terminate():
```
import threading
import subprocess
import multiprocessing
proc = subprocess.Popen(["sh", "-c", "exit 0"])
q = multiprocessing.Queue()
def communicate_thread(proc):
proc.communicate()
t = threading.Thread(target=communicate_thread, args=(proc,))
t.start()
proc.terminate()
t.join()
```
I'm reproducing this with Python 3.8.2 on Arch Linux by saving the script and rapidly executing it like this:
$ bash -e -c "while true; do python3 test.py; done
The (unused) multiprocessing.Queue seems to play a role here because the problem vanishes when removing that one line.
----------
components: Library (Lib)
messages: 368370
nosy: Alexander Overvoorde
priority: normal
severity: normal
status: open
title: Popen.terminate fails with ProcessLookupError under certain conditions
type: behavior
versions: Python 3.8
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40550>
_______________________________________
More information about the New-bugs-announce
mailing list