Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RpcTimeoutError when NAPALM API call times out #2588

Closed
jeremystretch opened this issue Nov 14, 2018 · 0 comments
Closed

RpcTimeoutError when NAPALM API call times out #2588

jeremystretch opened this issue Nov 14, 2018 · 0 comments
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@jeremystretch
Copy link
Member

Environment

  • Python version: 3.5.2
  • NetBox version: 2.4.7

Steps to Reproduce

This may not be perfectly reproducible as it depends on interaction with a live device. The issue I'm seeing is that a call for get_bgp_neighbors_detail() on a device will occasionally time out, prompting NetBox to raise an RpcTimeoutError exception. The full trace is included below.

Expected Behavior

The API should catch the exception and return an error message.

Observed Behavior

The exception is not caught, triggering a server error.

File "/opt/netbox/.venv/netbox/lib/python3.5/site-packages/jnpr/junos/device.py" in execute
  774.                                         ignore_warning=ignore_warning)

File "/opt/netbox/.venv/netbox/lib/python3.5/site-packages/jnpr/junos/decorators.py" in wrapper
  116.             rsp = function(self, *args, **kwargs)

File "/opt/netbox/.venv/netbox/lib/python3.5/site-packages/jnpr/junos/device.py" in _rpc_reply
  1323.         return self._conn.rpc(rpc_cmd_e)._NCElement__doc

File "/opt/netbox/.venv/netbox/lib/python3.5/site-packages/ncclient/manager.py" in wrapper
  180.                 return self.execute(op_cls, *args, **kwds)

File "/opt/netbox/.venv/netbox/lib/python3.5/site-packages/ncclient/manager.py" in execute
  240.                    raise_mode=self._raise_mode).request(*args, **kwds)

File "/opt/netbox/.venv/netbox/lib/python3.5/site-packages/ncclient/operations/third_party/juniper/rpc.py" in request
  46.         return self._request(rpc)

File "/opt/netbox/.venv/netbox/lib/python3.5/site-packages/ncclient/operations/rpc.py" in _request
  342.                 raise TimeoutExpiredError('ncclient timed out while waiting for an rpc reply.')

During handling of the above exception (ncclient timed out while waiting for an rpc reply.), another exception occurred:

File "/opt/netbox/.venv/netbox/lib/python3.5/site-packages/django/core/handlers/exception.py" in inner
  35.             response = get_response(request)

File "/opt/netbox/.venv/netbox/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
  128.                 response = self.process_exception_by_middleware(e, request)

File "/opt/netbox/.venv/netbox/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
  126.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/opt/netbox/.venv/netbox/lib/python3.5/site-packages/django/views/decorators/csrf.py" in wrapped_view
  54.         return view_func(*args, **kwargs)

File "/opt/netbox/.venv/netbox/lib/python3.5/site-packages/rest_framework/viewsets.py" in view
  103.             return self.dispatch(request, *args, **kwargs)

File "/opt/netbox/.venv/netbox/lib/python3.5/site-packages/rest_framework/views.py" in dispatch
  483.             response = self.handle_exception(exc)

File "/opt/netbox/.venv/netbox/lib/python3.5/site-packages/rest_framework/views.py" in handle_exception
  443.             self.raise_uncaught_exception(exc)

File "/opt/netbox/.venv/netbox/lib/python3.5/site-packages/rest_framework/views.py" in dispatch
  480.             response = handler(request, *args, **kwargs)

File "/opt/netbox/netbox/dcim/api/views.py" in napalm
  310.                 response[method] = getattr(d, method)()

File "/opt/netbox/.venv/netbox/lib/python3.5/site-packages/napalm/junos/junos.py" in get_bgp_neighbors_detail
  1323.                                                     neighbor_address=str(neighbor_address)).items()

File "/opt/netbox/.venv/netbox/lib/python3.5/site-packages/jnpr/junos/factory/optable.py" in get
  64.         self.xml = getattr(self.RPC, self.GET_RPC)(**rpc_args)

File "/opt/netbox/.venv/netbox/lib/python3.5/site-packages/jnpr/junos/rpcmeta.py" in _exec_rpc
  345.             return self._junos.execute(rpc, **dec_args)

File "/opt/netbox/.venv/netbox/lib/python3.5/site-packages/jnpr/junos/decorators.py" in wrapper
  63.                         result = function(*args, **kwargs)

File "/opt/netbox/.venv/netbox/lib/python3.5/site-packages/jnpr/junos/decorators.py" in wrapper
  31.                 return function(*args, **kwargs)

File "/opt/netbox/.venv/netbox/lib/python3.5/site-packages/jnpr/junos/device.py" in execute
  778.             raise EzErrors.RpcTimeoutError(self, rpc_cmd_e.tag, self.timeout)

Exception Type: RpcTimeoutError at /api/dcim/devices/29/napalm/
Exception Value: RpcTimeoutError(host: 192.0.2.1, cmd: get-bgp-neighbor-information, timeout: 30)
@jeremystretch jeremystretch added type: bug A confirmed report of unexpected behavior in the application status: accepted This issue has been accepted for implementation labels Nov 14, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jan 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

1 participant