[issue40550] Popen.terminate fails with ProcessLookupError under certain conditions

2020-12-03 Thread Jack O'Connor
Jack O'Connor added the comment: I'm late to the party, but I want to explain what's going on here in case it's helpful to folks. The issue you're seeing here has to do with whether a child processs has been "reaped". (Windows is different from Unix here, because the parent keeps an open han

[issue40550] Popen.terminate fails with ProcessLookupError under certain conditions

2020-11-21 Thread miss-islington
miss-islington added the comment: New changeset 713b4bbd97392acc492a4fefb2d07ae61fb7b75d by Miss Islington (bot) in branch '3.9': bpo-40550: Fix time-of-check/time-of-action issue in subprocess.Popen.send_signal. (GH-20010) https://github.com/python/cpython/commit/713b4bbd97392acc492a4fefb2d

[issue40550] Popen.terminate fails with ProcessLookupError under certain conditions

2020-11-21 Thread Gregory P. Smith
Gregory P. Smith added the comment: Thanks for the patch! PRs are in or on their way in for 3.10 and 3.9. The 3.8 auto-backport failed, if anyone wants it on a future 3.8.x please follow up with a manual cherry pick to make a PR for the 3.8 branch. -- resolution: -> fixed stage: pa

[issue40550] Popen.terminate fails with ProcessLookupError under certain conditions

2020-11-21 Thread miss-islington
Change by miss-islington : -- nosy: +miss-islington nosy_count: 3.0 -> 4.0 pull_requests: +22331 pull_request: https://github.com/python/cpython/pull/23439 ___ Python tracker _

[issue40550] Popen.terminate fails with ProcessLookupError under certain conditions

2020-11-21 Thread Gregory P. Smith
Gregory P. Smith added the comment: New changeset 01a202ab6b0ded546e47073db6498262086c52e9 by Filipe Laíns in branch 'master': bpo-40550: Fix time-of-check/time-of-action issue in subprocess.Popen.send_signal. (GH-20010) https://github.com/python/cpython/commit/01a202ab6b0ded546e47073db649826

[issue40550] Popen.terminate fails with ProcessLookupError under certain conditions

2020-11-21 Thread Gregory P. Smith
Change by Gregory P. Smith : -- assignee: -> gregory.p.smith nosy: +gregory.p.smith versions: +Python 3.10, Python 3.9 ___ Python tracker ___ _

[issue40550] Popen.terminate fails with ProcessLookupError under certain conditions

2020-05-08 Thread Alexander Overvoorde
Alexander Overvoorde added the comment: I understand that it's not a perfect solution, but at least it's a little bit closer. Thanks for your patch :) -- ___ Python tracker _

[issue40550] Popen.terminate fails with ProcessLookupError under certain conditions

2020-05-08 Thread Filipe Laíns
Filipe Laíns added the comment: I submitted a patch. As explained above, this only mitigates the time-of-check/time-of-action issue in case the process doesn't exist, it *is not* a proper fix for the issue. But don't see any way to properly fix it. --

[issue40550] Popen.terminate fails with ProcessLookupError under certain conditions

2020-05-08 Thread Filipe Laíns
Change by Filipe Laíns : -- keywords: +patch pull_requests: +19321 stage: -> patch review pull_request: https://github.com/python/cpython/pull/20010 ___ Python tracker ___

[issue40550] Popen.terminate fails with ProcessLookupError under certain conditions

2020-05-08 Thread Filipe Laíns
Filipe Laíns added the comment: This is a simple time-of-check - time-of-action issue, which is why I suggested that it shouldn't be fixed. I was not aware send_signal did have this check, which tells us it is supposed to be suported(?). Anyway, to fix it we need to catch the exception and ch

[issue40550] Popen.terminate fails with ProcessLookupError under certain conditions

2020-05-08 Thread Alexander Overvoorde
Alexander Overvoorde added the comment: I'm not sure that it is expected since Popen.send_signal does contain the following check: ``` def send_signal(self, sig): """Send a signal to the process.""" # Skip signalling a process that we know has already died. if self.returncode is N

[issue40550] Popen.terminate fails with ProcessLookupError under certain conditions

2020-05-07 Thread Filipe Laíns
Filipe Laíns added the comment: This is the backtrace I get: Traceback (most recent call last): File "/home/anubis/test/multiprocessing-error.py", line 16, in proc.terminate() File "/home/anubis/git/cpython/Lib/subprocess.py", line 2069, in terminate self.send_signal(signal.SIGTERM

[issue40550] Popen.terminate fails with ProcessLookupError under certain conditions

2020-05-07 Thread Alexander Overvoorde
New submission from Alexander Overvoorde : 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 comm