ncdiff icon indicating copy to clipboard operation
ncdiff copied to clipboard

Timeout during schema files download

Open cukiernick opened this issue 3 years ago • 1 comments

Timeout exception can be raised during schema download, and scan_models can still succeed (capabilites.txt file is created, no exception is raised). Some yang files may be missing, and because scan_models verifies only capabilities.txt against the remote ones, there is no attempt to download missing yang files on subsequent calls.

Traceback of worker thread:

Exception in thread download_worker_0:
Traceback (most recent call last):
  File "/usr/lib64/python3.9/threading.py", line 980, in _bootstrap_inner
    self.run()
  File "/home/user/ws/.venv39-yang/lib64/python3.9/site-packages/ncdiff/model.py", line 497, in run
    self.downloader.download(module)
  File "/home/user/ws/.venv39-yang/lib64/python3.9/site-packages/ncdiff/model.py", line 794, in download                                    
    reply = super(ModelDevice, self.device).execute(
  File "/home/user/ws/.venv39-yang/lib64/python3.9/site-packages/ncclient/manager.py", line 246, in execute                                                                                                          return cls(self._session,
  File "/home/user/ws/.venv39-yang/lib64/python3.9/site-packages/ncclient/operations/retrieve.py", line 199, in request                                                                                              return self._request(node)
  File "/home/user/ws/.venv39-yang/lib64/python3.9/site-packages/ncclient/operations/rpc.py", line 381, in _request                                                                                                  raise TimeoutExpiredError('ncclient timed out while waiting for an rpc reply.')
ncclient.operations.errors.TimeoutExpiredError: ncclient timed out while waiting for an rpc reply.

Main thread interrupted with ^C:

Traceback (most recent call last):
  File "/home/user/ws/solutions/c/yang/reprod.py", line 67, in <module>
    session.scan_models()
  File "/home/user/ws/.venv39-yang/lib64/python3.9/site-packages/ncdiff/manager.py", line 274, in scan_models
    d.download_all(check_before_download=(download == 'check'))
  File "/home/user/ws/.venv39-yang/lib64/python3.9/site-packages/ncdiff/model.py", line 763, in download_all
    self.download_queue.join()
  File "/usr/lib64/python3.9/queue.py", line 90, in join
    self.all_tasks_done.wait()
  File "/usr/lib64/python3.9/threading.py", line 312, in wait
    waiter.acquire()
KeyboardInterrupt

cukiernick avatar Sep 16 '22 08:09 cukiernick

Would increasing timeout help in your case?

>>> from ncdiff import manager
>>> m = manager.connect(host='2.3.4.5', port=830,
                        username='admin', password='admin',
                        hostkey_verify=False, look_for_keys=False)
>>> m.timeout = 120
>>> m.scan_models()

yuekyang avatar Sep 19 '22 18:09 yuekyang