This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Popen Timeout raised on 3.6 but not on 3.8
Type: Stage: resolved
Components: Versions: Python 3.8, Python 3.6
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: Joan Prat Rigol, iritkatriel, stestagg
Priority: normal Keywords:

Created on 2020-07-22 08:42 by Joan Prat Rigol, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg374089 - (view) Author: Joan Prat Rigol (Joan Prat Rigol) Date: 2020-07-22 08:42
If I run this code in Python 3.8 I get the result as expected:

Python 3.8.2 (default, Apr 27 2020, 15:53:34) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> process = subprocess.Popen("sudo -Si ls -l /home", shell=True, stdin=-1, stdout=-1, stderr=-1)
>>> out, err = process.communicate(input="Pr4tR1g01J04n\n".encode(), timeout=2)
>>> print(out)
b'total 4\ndrwxr-xr-x 43 joan joan 4096 Jul 22 09:46 joan\n'
>>> 
But If I run the code in Python 3.6 I am getting a timeout:

Python 3.6.9 (default, Apr 18 2020, 01:56:04) 
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> process = subprocess.Popen("sudo -Si ls -l /home", shell=True, stdin=-1, stdout=-1, stderr=-1)
>>> out, err = process.communicate(input="Pr4tR1g01J04n\n".encode(), timeout=2)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.6/subprocess.py", line 863, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
  File "/usr/lib/python3.6/subprocess.py", line 1535, in _communicate
    self._check_timeout(endtime, orig_timeout)
  File "/usr/lib/python3.6/subprocess.py", line 891, in _check_timeout
    raise TimeoutExpired(self.args, orig_timeout)
subprocess.TimeoutExpired: Command 'sudo -Si ls -l /home' timed out after 2 seconds
>>> 
Is this a bug?
msg374134 - (view) Author: Steve Stagg (stestagg) Date: 2020-07-23 12:50
Joan, is that your *actual* password in the example code?  If so, I'd recommend changing it wherever you've used it.
msg400911 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2021-09-02 10:33
3.6 is no longer maintained, so even if there was a bug in 3.6 that was fixed in 3.8 we aren't going to be able to do anything about it.

If nobody objects I will close this issue soon.
History
Date User Action Args
2022-04-11 14:59:34adminsetgithub: 85539
2021-09-19 22:20:15iritkatrielsetstatus: pending -> closed
stage: resolved
2021-09-02 10:33:31iritkatrielsetstatus: open -> pending

nosy: + iritkatriel
messages: + msg400911

resolution: out of date
2020-07-23 12:50:45stestaggsetnosy: + stestagg
messages: + msg374134
2020-07-22 08:42:59Joan Prat Rigolcreate