SSHLibrary read_until_regexp and other read_* methods raise RuntimeError unexpectedly even with large timeouts. Possibly truncating output?

Hi,

I am experiencing issues with using the read_until_regexp and read_until_prompt when writing commands which are returning large outputs.

Details

  • I am succesfully connecting to the target node using SSHLibrary().
  • The expected time for the server to provide the output is 20 seconds, which is the time it takes for server to provide output when command is ran manually.
  • I have verified that I have set prompt correctly and regexp pattern correctly since commands that return smaller outputs work flawless.

What DOES work

self.ssh = SSHLibrary()
…
ssh.write(command)
output = self.read(delay=timeout)

However, this is not what I want since everytime I use this keyword I would have to wait timeout seconds for the response.

What does NOT work using same timeout value.

“”“Not working option”“”

self.ssh.write(command)
output = self.ssh.read_until_regexp(regexp=verified_pattern, timeout=timeout)

“”“Another not working option”“”

self.ssh.write(command)
self.ssh.read_until_prompt(timeout=timeout)

The RuntimeError that is raised has following pattern

No match found for <the pattern> in <truncated part of the expected output, truncated before prompt or regexp is seen>

The truncated output in the error message is 103k chars long out of expected 132k chars which is returned when using self.ssh.read(delay=timeout)

So my question is

  • Is there any limitation for maximum expected output when using the read_until_prompt / read_until_regexp?
  • If so, is it possible to increase it via some configuration?
  • If not, what could otherwise be the issue due to this?

Thanks in advance for any help.

1 Like