paramiko-expect icon indicating copy to clipboard operation
paramiko-expect copied to clipboard

Expect hanging when self.current_output is too large

Open oskrdt opened this issue 4 years ago • 3 comments

I have a process that is monitoring the install/boot progress with paramiko expect, but when monitoring a specific very large system that produces a huge amount of output per minute, it seems that expect method hangs and it's not even failing for the timeout as it should. When debugging, I realized that the condition where is trying to match the regex strings is rapidly increasing the time it takes to execute.

            not [re_string
                 for re_string in re_strings
                 if re.match(default_match_prefix + re_string + '$',
                             self.current_output, re.DOTALL)]

So it seems the time it takes to look for a match on self.current_output is taking more than the time the buffer gets filled up again.

oskrdt avatar Nov 04 '20 22:11 oskrdt

@oskrdt yep the design of it doesn't take into account very big output.

it should be kind of cyclic buffer.

Anyhow PRs are welcomed

fruch avatar Jan 24 '21 21:01 fruch

Please check 0.3.0, should have a fix for this. If it works for you we can close this

sar772004 avatar Jan 27 '21 02:01 sar772004

I'm working with @oskrdt in the same project checking this, and it seems that we're blocked by #67 since the latest version I can gather is 0.2.9 instead of 0.3.0 I tried both python3 -m pip install --upgrade paramiko-expect and python3 -m pip install git+https://github.com/fgimian/paramiko-expect.git and I can't get the latest version (0.3.0)

dgonzalez-cs avatar Jan 28 '21 01:01 dgonzalez-cs