bpo-37091: subprocess - Handle uncaught PermissionError in send_signal#13669
bpo-37091: subprocess - Handle uncaught PermissionError in send_signal#13669wesinator wants to merge 2 commits into
Conversation
Encountered a condition where uncaught PermissionError caused a hang running a subprocess command with `sudo -u` see also xonsh/xonsh#2887 (comment)
gpshead
left a comment
There was a problem hiding this comment.
Just surround the os.kill call with this. Also, please file a related https://bugs.python.org/ issue to track the bug.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase And if you don't make the requested changes, you will be put in the comfy chair! |
|
Hmm, this is still hanging with the patch: Traceback (most recent call last):
File "/usr/lib/python3.7/subprocess.py", line 474, in run
stdout, stderr = process.communicate(input, timeout=timeout)
File "/usr/lib/python3.7/subprocess.py", line 939, in communicate
stdout, stderr = self._communicate(input, endtime, timeout)
File "/usr/lib/python3.7/subprocess.py", line 1707, in _communicate
self.wait(timeout=self._remaining_time(endtime))
File "/usr/lib/python3.7/subprocess.py", line 990, in wait
return self._wait(timeout=timeout)
File "/usr/lib/python3.7/subprocess.py", line 1616, in _wait
raise TimeoutExpired(self.args, timeout)the code has the following except blocks: except subprocess.TimeoutExpired as e:
try:
print(e)
except PermissionError:
print(e)
# handle race condition hanging issue
except PermissionError:
pass |
|
This PR would change the behavior of send_signal to hide errors from people. We don't want to do that. |
Encountered a condition where uncaught PermissionError caused a hang
running a subprocess command with
sudo -uPython 3.7.3
Ubuntu 18.10 Cosmic
see also xonsh/xonsh#2887 (comment)
https://bugs.python.org/issue37091