question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TimeoutError('Timed out reading from transport') for Junos

See original GitHub issue

Scrapli works well for cases when configuration is error free, but if there is a typo - it will hang for a while untill Timeout is reached, but the session would be still connected

Here is a basic configuration that I used:

from scrapli.driver.core import JunosDriver my_device = { “host”: “192.168.226.139”, “auth_username”: “test”, “auth_password”: “~!QAZXSW@”, “auth_strict_key”: False } conn = JunosDriver(**my_device) conn.open() print(conn.send_command(“configure exclusive”).result) commands = [“set system services ssh”,“set system services nestconf ssh”] for command in commands: print("sending line - "+command) response = conn.send_config(command, strip_prompt=False) print(response.result) conn.close()

To Reproduce Steps to reproduce the behavior:

  1. run the script with several commands and one of them should contain typo
  2. Junos vMX with VCP/VFP v 17.2R1.13

Expected behavior I would expect to have it like “set system services nestconfssh” as Junos parser would not recognize command and get an error from parser, but I don’t see that command was ever entered (by using - “show log interactive-commands” on vMX)

Stack Trace

/home/python/PycharmProjects/config_deploy/venv/bin/python /home/python/PycharmProjects/config_deploy/scrapli_test.py
warning: uncommitted changes will be discarded on exit
Entering configuration mode

[edit]
sending line - set system services ssh
[edit]
test@LAB-ROUTER#
sending line - set system services nestconf ssh
Traceback (most recent call last):
  File "/home/python/PycharmProjects/config_deploy/scrapli_test.py", line 16, in <module>
    response = conn.send_config(command, strip_prompt=False)
  File "/home/python/PycharmProjects/config_deploy/venv/lib/python3.8/site-packages/scrapli/driver/network_driver.py", line 392, in send_config
    multi_response = self.send_configs(
  File "/home/python/PycharmProjects/config_deploy/venv/lib/python3.8/site-packages/scrapli/driver/network_driver.py", line 445, in send_configs
    response = super().send_command(
  File "/home/python/PycharmProjects/config_deploy/venv/lib/python3.8/site-packages/scrapli/driver/generic_driver.py", line 75, in send_command
    raw_response, processed_response = self.channel.send_input(
  File "/home/python/PycharmProjects/config_deploy/venv/lib/python3.8/site-packages/scrapli/channel/channel.py", line 165, in send_input
    raw_result, processed_result = self._send_input(
  File "/home/python/PycharmProjects/config_deploy/venv/lib/python3.8/site-packages/scrapli/decorators.py", line 77, in timeout_wrapper
    return future.result()
  File "/usr/lib/python3.8/concurrent/futures/_base.py", line 432, in result
    return self.__get_result()
  File "/usr/lib/python3.8/concurrent/futures/_base.py", line 388, in __get_result
    raise self._exception
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/python/PycharmProjects/config_deploy/venv/lib/python3.8/site-packages/scrapli/channel/channel.py", line 192, in _send_input
    self._read_until_input(channel_input=bytes_channel_input)
  File "/home/python/PycharmProjects/config_deploy/venv/lib/python3.8/site-packages/scrapli/channel/channel.py", line 82, in _read_until_input
    output += self._read_chunk()
  File "/home/python/PycharmProjects/config_deploy/venv/lib/python3.8/site-packages/scrapli/channel/channel.py", line 47, in _read_chunk
    new_output = self.transport.read()
  File "/home/python/PycharmProjects/config_deploy/venv/lib/python3.8/site-packages/scrapli/decorators.py", line 104, in requires_open_session_wrapper
    return wrapped_func(*args, **kwargs)
  File "/home/python/PycharmProjects/config_deploy/venv/lib/python3.8/site-packages/scrapli/decorators.py", line 76, in timeout_wrapper
    raise TimeoutError(message)
TimeoutError: Timed out reading from transport


OS:

  • OS: Ubuntu 20.04
  • scrapli version 2020.7.12

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:15 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
carlmontanaricommented, Jul 19, 2020

updated develop branch with the fix. still doing some testing locally but I think it should be good to try!

1reaction
carlmontanaricommented, Jul 19, 2020

Hopefully I’ll merge/release next weekend – I’ve got a few other things I’m working on I’d like to include in the next release!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolved Issues | Junos OS Release 15.1F2 for the M Series ...
This section lists the issues fixed in the Junos OS main release and the ... if the interface state changes or the request...
Read more >
Ncclient timed out when using junos_vlan : r/ansible - Reddit
I read about a guy finding a workaround editing the module file: Ansible, Juniper CLI commands. Timeout Error?
Read more >
10060 Connection timed out error with proxy server or ISA ...
It is reset when responses resume. The base timeout value is dynamically determined by the measured round-trip time on the connection. The ...
Read more >
scrapli 2020.2.9 - PyPI
timeout_ssh sets the timeout for the actual SSH session when using ssh2 or paramiko transport options. When using system SSH, this is currently ......
Read more >
Common Services — Unicon Documentation - DevNet
timeout in sec (default 10 seconds). size. int. read size in bytes for reading the buffer. target. str.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found