fgimian / paramiko-expect

A Python expect-like extension for the Paramiko SSH library which also supports tailing logs.
MIT License
204 stars 78 forks source link

EXCESS TIME RECV_READY TIMEOUT, did you expect() before a send() on offical sample. #71

Open tirans opened 3 years ago

tirans commented 3 years ago

I've tried the paramiko_expect-tail-demo sample since I started to receive the "excess time RECV_READY..." err on my code . tried sample and got the prompt too. i noticed the following: line 39 : interact.expect(prompt)

    # Send the tail command
      interact.send('tail -f /var/log/syslog')

so, is this example working? as the message implies that the code order will fail.

dgonzalez-cs commented 3 years ago

I also hit this message and I just saw where this is coming from

            # avoids paramiko hang when recv is not ready yet        < On line 161
            while not self.channel.recv_ready():
                time.sleep(.009)
                if time.time() >= (base_time + timeout):
                    print('EXCESS TIME RECV_READY TIMEOUT, did you expect() before a send()')
                    return -1

Could we use a debug flag in the object or use a python logger to avoid having this printed every single time?

jgmitchell257 commented 3 years ago

I had this same issue in a script I was running. I found there was an extra interact.expect() at the end of my script that wasn't looking for anything. As soon as I removed it, the message went away.

fruch commented 2 years ago

I also hit this message and I just saw where this is coming from

            # avoids paramiko hang when recv is not ready yet        < On line 161
            while not self.channel.recv_ready():
                time.sleep(.009)
                if time.time() >= (base_time + timeout):
                    print('EXCESS TIME RECV_READY TIMEOUT, did you expect() before a send()')
                    return -1

Could we use a debug flag in the object or use a python logger to avoid having this printed every single time?

Using logging is a good idea here...

tirans commented 2 years ago

@fruch this started on the 0.2.9 not happening on 0.2.8 which is stable for me.

msdian-hub commented 1 year ago

Hello @fruch. Can you please explain, what is the issue with this error?

I am getting this error also. But I am not able to understand what is the problem.

Why am I getting this error?

Thanks in advance.

fruch commented 1 year ago

Hello @fruch. Can you please explain, what is the issue with this error?

I am getting this error also. But I am not able to understand what is the problem.

Why am I getting this error?

Thanks in advance.

As the error suggests, you might be doing expect call without sending anything before that.

Anyhow without seeing the exact code you are trying and more information, like python version, OS type, which machines you are connecting to, it's hard to talk about any issue.