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

Keep getting Connection Reset #594

Closed
rostskadat opened this issue Dec 6, 2023 · 2 comments
Closed

Keep getting Connection Reset #594

rostskadat opened this issue Dec 6, 2023 · 2 comments
Labels
type: bug A confirmed report of unexpected behavior in the application

Comments

@rostskadat
Copy link

pynetbox version

v7.2.0

NetBox version

v3.0.12

Python version

3.10

Steps to Reproduce

  1. Get an API:
nb = pynetbox.api(args.api_url, token=args.token)
  1. Create a VRF:
vrf = nb.ipam.vrfs.create(name="name", description="description")
  1. Then try to obtain a cluster id
cluster_id = nb.virtualization.clusters.filter(cluster=cluster).__next__().id

This fails with a ConnectionResetError:

ERROR | ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
Traceback (most recent call last):
  File "/home/rostskadat/git/upworks/Freelance-73-Gitlab-CICD/.venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 790, in urlopen
    response = self._make_request(
  File "/home/rostskadat/git/upworks/Freelance-73-Gitlab-CICD/.venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 536, in _make_request
    response = conn.getresponse()
  File "/project/.venv/lib/python3.10/site-packages/urllib3/connection.py", line 461, in getresponse
    httplib_response = super().getresponse()
  File "/usr/lib/python3.10/http/client.py", line 1375, in getresponse
    response.begin()
  File "/usr/lib/python3.10/http/client.py", line 318, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.10/http/client.py", line 279, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/lib/python3.10/socket.py", line 705, in readinto
    return self._sock.recv_into(b)
ConnectionResetError: [Errno 104] Connection reset by peer

Expected Behavior

The error is intermittent. If I add an HTTPAdapter with a retry then it eventually works fine.

Observed Behavior

A ConnectionResetError was raised

@rostskadat rostskadat added the type: bug A confirmed report of unexpected behavior in the application label Dec 6, 2023
@markkuleinio
Copy link
Contributor

markkuleinio commented Dec 9, 2023

I'd suggest moving this issue to a discussion as pynetbox does not raise ConnectionResetErrors, so the user needs some other help with the system.

There is no mention about the runtime environment but the output is not from from a pure cluster_id = ... statement.

@rostskadat
Copy link
Author

rostskadat commented Dec 10, 2023

Hello @markkuleinio ,

Thanks for your reply. I did some more digging and found out that the problem is in fact related to the uwsgi used to run the server. There is a discussion over at lae/ansible-role-netbox about this. And the work around did solve the problem. I'm therefore closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

2 participants