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
This is possibly related to Bug #515, command hangs forever.
I'm running Python 3.5.2, paramiko 2.0.1
I have code that checks to see if I am at a command prompt, I first call recv_ready to see if there is data to be read, and if so, I read it. I have found that if the device I'm talking to stops sending data, recv_ready incorrectly thinks that there is data to be read, which causes a hang.
def checkPrompt():
if (not ssh_shell.recv_ready):
print("not ready... ", end='')
return False
output = ssh_shell.recv(1000)
print("read %s characters" % len(output))
output = output.decode("utf-8")
# Print the output before stripping characters off
print(output, end='')
output = output.strip()
return output.endswith('#')
The particular command I'm sending to my switch is telling it to tftp a new firmware file to its flash, this takes about 60 seconds, and I'm seeing progress data coming back as expected. Then the unit verifies the firmware, this process takes close to 3 minutes, and no (visible?) output is seen in an SSH session (verified by opening an SSH session with Putty).
During this 3 minute period, my call to the above checkPrompt() should be repeatedly outputting 'not ready..." every time if recv_ready is not true. But I'm not seeing this message appear, so there looks like there is data waiting to be read, but when I call to recv the data, it hangs.
I'm stumped on why this is happening. As far as I know, there is no way to check how much data is waiting on the buffer, or to somehow debug the buffer contents prior to reading the buffer.
The text was updated successfully, but these errors were encountered:
Hmm, are you testing ssh_shell.recv_ready, or ssh_shell.recv_ready() ? The former will always evaluate to True for an instancemethod, and the posted code doesn't show the call ().
This is possibly related to Bug #515, command hangs forever.
I'm running Python 3.5.2, paramiko 2.0.1
I have code that checks to see if I am at a command prompt, I first call recv_ready to see if there is data to be read, and if so, I read it. I have found that if the device I'm talking to stops sending data, recv_ready incorrectly thinks that there is data to be read, which causes a hang.
The particular command I'm sending to my switch is telling it to tftp a new firmware file to its flash, this takes about 60 seconds, and I'm seeing progress data coming back as expected. Then the unit verifies the firmware, this process takes close to 3 minutes, and no (visible?) output is seen in an SSH session (verified by opening an SSH session with Putty).
During this 3 minute period, my call to the above checkPrompt() should be repeatedly outputting 'not ready..." every time if recv_ready is not true. But I'm not seeing this message appear, so there looks like there is data waiting to be read, but when I call to recv the data, it hangs.
I'm stumped on why this is happening. As far as I know, there is no way to check how much data is waiting on the buffer, or to somehow debug the buffer contents prior to reading the buffer.
The text was updated successfully, but these errors were encountered: