You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pssh.clients does not timeout if an invalid (non-reachable) IP is given, but pssh.pssh_client (deprecated method) timesout as expected. I suspect some bug has been introduced in the recent method.
Steps to reproduce:
CODE:
from pssh.clients import ParallelSSHClient
from pssh.exceptions import Timeout
hosts = [ IP1, IP2 ... ] #Have at least one bad IP in here.
host_config = { IP1: { 'user':'root', 'password': 'mypass', 'port':22 }, IP2: ... }
clients = ParallelSSHClient(hosts, host_config=host_config, num_retries=1, timeout=5)
output = clients.run_command("echo Hello", stop_on_errors=False) <-- Hangs here forever.
try: <-- Never reaches this point.
clients.join(output)
except Timeout:
pass
STACK TRACE WHEN PRESSING ^C
Run the file with #python test.py
<It hangs forever and need to press ^C to get out".
File "/root/project/.fenv/local/lib/python2.7/site-packages/pssh/clients/native/parallel.py", line 188, in run_command
encoding=encoding, use_pty=use_pty, timeout=timeout)
File "/root/project/.fenv/local/lib/python2.7/site-packages/pssh/clients/base_pssh.py", line 91, in run_command
self.get_output(cmd, output)
File "//root/project/.fenv/local/lib/python2.7/site-packages/pssh/clients/base_pssh.py", line 145, in get_output
(channel, host, stdout, stderr, stdin) = cmd.get()
File "src/gevent/greenlet.py", line 654, in gevent._greenlet.Greenlet.get
File "src/gevent/greenlet.py", line 642, in gevent._greenlet.Greenlet.get
File "src/gevent/_greenlet_primitives.py", line 59, in gevent.__greenlet_primitives.SwitchOutGreenletWithLoop.switch
File "src/gevent/_greenlet_primitives.py", line 63, in gevent.__greenlet_primitives.SwitchOutGreenletWithLoop.switch
File "src/gevent/__greenlet_primitives.pxd", line 35, in gevent.__greenlet_primitives._greenlet_switch
KeyboardInterrupt
Expected behaviour: [What was expected to happen.]
It should have timed out and given the result for the rest of the IP's which were valid.
Actual behaviour: [What actually happened.]
It hangs forever. However, if you replace the import pssh.clients with the deprecated method pssh.pssh_client, it will timeout as expected for the bad IPs.
Additional info: [Include version of ssh2-python and/or paramiko and any other relevant information.]
Some of the relevant libs in my virtualenv.
Looks like a bug in the way timeout setting is applied to socket used by native client. The back-end library expects timeout in ms, while gevent socket timeout is in seconds. The timeout is wrongly applied to the socket, making it longer than the intended setting.
Bug reports
pssh.clients does not timeout if an invalid (non-reachable) IP is given, but pssh.pssh_client (deprecated method) timesout as expected. I suspect some bug has been introduced in the recent method.
Steps to reproduce:
CODE:
STACK TRACE WHEN PRESSING ^C
Run the file with #python test.py
<It hangs forever and need to press ^C to get out".
Expected behaviour: [What was expected to happen.]
It should have timed out and given the result for the rest of the IP's which were valid.
Actual behaviour: [What actually happened.]
It hangs forever. However, if you replace the import pssh.clients with the deprecated method pssh.pssh_client, it will timeout as expected for the bad IPs.
Additional info: [Include version of
ssh2-python
and/orparamiko
and any other relevant information.]Some of the relevant libs in my virtualenv.
The text was updated successfully, but these errors were encountered: