netdevopsbr / netbox-proxbox

Netbox Plugin for integration between Proxmox and Netbox
Apache License 2.0
375 stars 52 forks source link

('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')) #148

Open nmolenaar opened 1 year ago

nmolenaar commented 1 year ago

When clicking the button "Proxmox full update" I get a new page with the following stack trace:

I see 2 requests happening in Proxmox, but no errors or anything like that on the Proxmox side.

Environment:

Request Method: GET
Request URL: http://192.168.178.70:8000/plugins/proxbox/full_update/

Django Version: 4.2.5
Python Version: 3.11.4
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.humanize',
 'corsheaders',
 'debug_toolbar',
 'graphiql_debug_toolbar',
 'django_filters',
 'django_tables2',
 'django_prometheus',
 'graphene_django',
 'mptt',
 'rest_framework',
 'social_django',
 'taggit',
 'timezone_field',
 'core',
 'account',
 'circuits',
 'dcim',
 'ipam',
 'extras',
 'tenancy',
 'users',
 'utilities',
 'virtualization',
 'wireless',
 'django_rq',
 'drf_spectacular',
 'drf_spectacular_sidecar',
 'netbox_proxbox.ProxboxConfig']
Installed Middleware:
['graphiql_debug_toolbar.middleware.DebugToolbarMiddleware',
 'django_prometheus.middleware.PrometheusBeforeMiddleware',
 'corsheaders.middleware.CorsMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'django.middleware.security.SecurityMiddleware',
 'netbox.middleware.RemoteUserMiddleware',
 'netbox.middleware.CoreMiddleware',
 'netbox.middleware.MaintenanceModeMiddleware',
 'django_prometheus.middleware.PrometheusAfterMiddleware']

Traceback (most recent call last):
  File "/opt/netbox/venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 714, in urlopen
    httplib_response = self._make_request(

  File "/opt/netbox/venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 466, in _make_request
    six.raise_from(e, None)
    ^^^^^^^^^^^^^^^^^^^^^^^
  File "<string>", line 3, in raise_from
    # Permission is hereby granted, free of charge, to any person obtaining a copy
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 461, in _make_request
    httplib_response = conn.getresponse()
                       ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/http/client.py", line 1378, in getresponse
    response.begin()
    ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/http/client.py", line 318, in begin
    version, status, reason = self._read_status()
                              ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/http/client.py", line 279, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/socket.py", line 706, in readinto
    return self._sock.recv_into(b)
           ^^^^^^^^^^^^^^^^^^^^^^^

During handling of the above exception ([Errno 104] Connection reset by peer), another exception occurred:
  File "/opt/netbox/venv/lib/python3.11/site-packages/requests/adapters.py", line 486, in send
    resp = conn.urlopen(

  File "/opt/netbox/venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 798, in urlopen
    retries = retries.increment(

  File "/opt/netbox/venv/lib/python3.11/site-packages/urllib3/util/retry.py", line 550, in increment
    raise six.reraise(type(error), error, _stacktrace)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.11/site-packages/urllib3/packages/six.py", line 769, in reraise
    raise value.with_traceback(tb)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 714, in urlopen
    httplib_response = self._make_request(

  File "/opt/netbox/venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 466, in _make_request
    six.raise_from(e, None)
    ^^^^^^^^^^^^^^^^^^^^^^^
  File "<string>", line 3, in raise_from
    # Permission is hereby granted, free of charge, to any person obtaining a copy
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 461, in _make_request
    httplib_response = conn.getresponse()
                       ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/http/client.py", line 1378, in getresponse
    response.begin()
    ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/http/client.py", line 318, in begin
    version, status, reason = self._read_status()
                              ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/http/client.py", line 279, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/socket.py", line 706, in readinto
    return self._sock.recv_into(b)
           ^^^^^^^^^^^^^^^^^^^^^^^

During handling of the above exception (('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))), another exception occurred:
  File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view
    return self.dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.11/site-packages/django/contrib/auth/mixins.py", line 109, in dispatch
    return super().dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.11/site-packages/django/views/generic/base.py", line 143, in dispatch
    return handler(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.11/site-packages/netbox_proxbox/views.py", line 93, in get
    "virtualmachines_table": VMUpdateResult(proxbox_api.update.all(remove_unused = True)["virtualmachines"]),
                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.11/site-packages/netbox_proxbox/proxbox_api/update.py", line 420, in all
    cluster = create.virtualization.cluster()
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.11/site-packages/netbox_proxbox/proxbox_api/create/virtualization.py", line 68, in cluster
    type = cluster_type().slug
           ^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.11/site-packages/netbox_proxbox/proxbox_api/create/virtualization.py", line 25, in cluster_type
    cluster_type_proxbox = nb.virtualization.cluster_types.get(

  File "/opt/netbox/venv/lib/python3.11/site-packages/pynetbox/core/endpoint.py", line 161, in get
    ret = next(resp, None)
          ^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.11/site-packages/pynetbox/core/response.py", line 127, in __next__
    next(self.response), self.endpoint.api, self.endpoint
    ^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.11/site-packages/pynetbox/core/query.py", line 291, in get
    req = self._make_call(add_params=add_params)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.11/site-packages/pynetbox/core/query.py", line 241, in _make_call
    req = getattr(self.http_session, verb)(

  File "/opt/netbox/venv/lib/python3.11/site-packages/requests/sessions.py", line 602, in get
    return self.request("GET", url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.11/site-packages/requests/adapters.py", line 501, in send
    raise ConnectionError(err, request=request)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Exception Type: ConnectionError at /plugins/proxbox/full_update/
Exception Value: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
kpma1985 commented 1 year ago

did u wanted to start before u migrate the database?

shakin89 commented 7 months ago

I've got the same problem I have netbox 3.7.3 behind uwsgi

2024-03-30 18:01:52,282 netbox.config DEBUG: Loaded configuration data from cache
2024-03-30 18:01:52,282 netbox.config DEBUG: Initialized configuration
2024-03-30 18:01:52,352 netbox.config DEBUG: Loaded configuration data from cache
2024-03-30 18:01:52,352 netbox.config DEBUG: Initialized configuration
2024-03-30 18:01:52,383 netbox.config DEBUG: Cleared configuration
2024-03-30 18:01:52,389 django.request ERROR: Internal Server Error: /plugins/proxbox/full_update/
Traceback (most recent call last):
  File "/opt/netbox/current/venv-py3/lib/python3.11/site-packages/urllib3/connectionpool.py", line 793, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/current/venv-py3/lib/python3.11/site-packages/urllib3/connectionpool.py", line 537, in _make_request
    response = conn.getresponse()
               ^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/current/venv-py3/lib/python3.11/site-packages/urllib3/connection.py", line 466, in getresponse
    httplib_response = super().getresponse()
                       ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/http/client.py", line 1374, in getresponse
    response.begin()
  File "/usr/lib/python3.11/http/client.py", line 318, in begin
    version, status, reason = self._read_status()
                              ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/http/client.py", line 279, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/socket.py", line 706, in readinto
    return self._sock.recv_into(b)
           ^^^^^^^^^^^^^^^^^^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/netbox/current/venv-py3/lib/python3.11/site-packages/requests/adapters.py", line 486, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/opt/netbox/current/venv-py3/lib/python3.11/site-packages/urllib3/connectionpool.py", line 847, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/current/venv-py3/lib/python3.11/site-packages/urllib3/util/retry.py", line 470, in increment
    raise reraise(type(error), error, _stacktrace)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/current/venv-py3/lib/python3.11/site-packages/urllib3/util/util.py", line 38, in reraise
    raise value.with_traceback(tb)
  File "/opt/netbox/current/venv-py3/lib/python3.11/site-packages/urllib3/connectionpool.py", line 793, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/current/venv-py3/lib/python3.11/site-packages/urllib3/connectionpool.py", line 537, in _make_request
    response = conn.getresponse()
               ^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/current/venv-py3/lib/python3.11/site-packages/urllib3/connection.py", line 466, in getresponse
    httplib_response = super().getresponse()
                       ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/http/client.py", line 1374, in getresponse
    response.begin()
  File "/usr/lib/python3.11/http/client.py", line 318, in begin
    version, status, reason = self._read_status()
                              ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/http/client.py", line 279, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/socket.py", line 706, in readinto
    return self._sock.recv_into(b)
           ^^^^^^^^^^^^^^^^^^^^^^^
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/netbox/current/venv-py3/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/current/venv-py3/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/current/venv-py3/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view
    return self.dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/current/venv-py3/lib/python3.11/site-packages/django/contrib/auth/mixins.py", line 109, in dispatch
    return super().dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/current/venv-py3/lib/python3.11/site-packages/django/views/generic/base.py", line 143, in dispatch
    return handler(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/current/venv-py3/lib/python3.11/site-packages/netbox_proxbox/views.py", line 93, in get
    "virtualmachines_table": VMUpdateResult(proxbox_api.update.all(remove_unused = True)["virtualmachines"]),
                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/current/venv-py3/lib/python3.11/site-packages/netbox_proxbox/proxbox_api/update.py", line 420, in all
    cluster = create.virtualization.cluster()
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/current/venv-py3/lib/python3.11/site-packages/netbox_proxbox/proxbox_api/create/virtualization.py", line 66, in cluster
    cluster_proxbox = nb.virtualization.clusters.get(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/current/venv-py3/lib/python3.11/site-packages/pynetbox/core/endpoint.py", line 161, in get
    ret = next(resp, None)
          ^^^^^^^^^^^^^^^^
  File "/opt/netbox/current/venv-py3/lib/python3.11/site-packages/pynetbox/core/response.py", line 127, in __next__
    next(self.response), self.endpoint.api, self.endpoint
    ^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/current/venv-py3/lib/python3.11/site-packages/pynetbox/core/query.py", line 291, in get
    req = self._make_call(add_params=add_params)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/current/venv-py3/lib/python3.11/site-packages/pynetbox/core/query.py", line 241, in _make_call
    req = getattr(self.http_session, verb)(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/current/venv-py3/lib/python3.11/site-packages/requests/sessions.py", line 602, in get
    return self.request("GET", url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/current/venv-py3/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/current/venv-py3/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/current/venv-py3/lib/python3.11/site-packages/requests/adapters.py", line 501, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
2024-03-30 18:01:52,399 netbox.config DEBUG: Cleared configuration

This happens enabling ssl on proxmox with a letsencrypt certificate, and even disabling ssl.

These are the current installed packages

Package                       Version
----------------------------- -----------
aniso8601                     9.0.1
asgiref                       3.8.1
async-timeout                 4.0.3
attrs                         23.2.0
Babel                         2.14.0
bleach                        6.1.0
certifi                       2024.2.2
cffi                          1.16.0
charset-normalizer            3.3.2
click                         8.1.7
colorama                      0.4.6
cryptography                  42.0.5
defusedxml                    0.8.0rc2
Django                        4.2.11
django-cors-headers           4.3.1
django-debug-toolbar          4.3.0
django-filter                 24.1
django-graphiql-debug-toolbar 0.2.0
django-js-asset               2.2.0
django-mptt                   0.14.0
django-pglocks                1.0.4
django-prometheus             2.3.1
django-redis                  5.4.0
django-rich                   1.8.0
django-rq                     2.10.1
django-tables2                2.7.0
django-taggit                 5.0.1
django-timezone-field         6.1.0
djangorestframework           3.14.0
dnspython                     2.6.1
drf-spectacular               0.27.1
drf-spectacular-sidecar       2024.3.4
feedparser                    6.0.11
ghp-import                    2.1.0
graphene                      3.3
graphene-django               3.0.0
graphql-core                  3.2.3
graphql-relay                 3.2.0
gunicorn                      21.2.0
idna                          3.6
inflection                    0.5.1
Jinja2                        3.1.3
jsonschema                    4.21.1
jsonschema-specifications     2023.12.1
Markdown                      3.5.2
markdown-it-py                3.0.0
MarkupSafe                    2.1.5
mdurl                         0.1.2
mergedeep                     1.3.4
mkdocs                        1.5.3
mkdocs-autorefs               1.0.1
mkdocs-material               9.5.13
mkdocs-material-extensions    1.3.1
mkdocstrings                  0.24.1
mkdocstrings-python-legacy    0.2.3
netaddr                       1.2.1
netbox-plugin-dns             0.22.6
netbox-proxbox                0.0.5
oauthlib                      3.2.2
packaging                     23.2
paginate                      0.5.6
pathspec                      0.12.1
pillow                        10.2.0
pip                           24.0
platformdirs                  4.2.0
prometheus_client             0.20.0
promise                       2.3
proxmoxer                     2.0.1
psycopg                       3.1.18
psycopg-binary                3.1.18
psycopg-pool                  3.2.1
pycparser                     2.22
Pygments                      2.17.2
PyJWT                         2.8.0
pymdown-extensions            10.7.1
pynetbox                      7.3.3
python-dateutil               2.9.0.post0
python3-openid                3.2.0
pytkdocs                      0.16.1
pytz                          2024.1
PyYAML                        6.0.1
pyyaml_env_tag                0.1
redis                         5.0.3
referencing                   0.34.0
regex                         2023.12.25
requests                      2.31.0
requests-oauthlib             2.0.0
rich                          13.7.1
rpds-py                       0.18.0
rq                            1.16.1
setuptools                    69.2.0
sgmllib3k                     1.0.0
six                           1.16.0
social-auth-app-django        5.4.0
social-auth-core              4.5.3
sqlparse                      0.4.4
svgwrite                      1.4.3
tablib                        3.5.0
text-unidecode                1.3
typing_extensions             4.10.0
tzdata                        2024.1
uritemplate                   4.1.1
urllib3                       2.2.1
watchdog                      4.0.0
webencodings                  0.5.1

Url requested

[pid: 10182|app: 0|req: 1/1] 172.30.20.120 () {40 vars in 911 bytes} [Sat Mar 30 18:04:51 2024] GET /plugins/proxbox/ => generated 105487 bytes in 2626 msecs (HTTP/1.1 200) 9 headers in 438 bytes (2 switches on core 0)
[pid: 10181|app: 0|req: 1/2] 172.30.10.20 () {30 vars in 546 bytes} [Sat Mar 30 18:04:58 2024] GET /api/virtualization/cluster-types/?name=Proxmox&slug=proxmox&limit=0 => generated 402 bytes in 2408 msecs (HTTP/1.1 200) 9 headers in 344 bytes (2 switches on core 0)
[pid: 10184|app: 0|req: 1/3] 172.30.20.120 () {38 vars in 893 bytes} [Sat Mar 30 18:04:56 2024] GET /plugins/proxbox/full_update/ => generated 1726 bytes in 4878 msecs (HTTP/1.1 500) 8 headers in 319 bytes (2 switches on core 0)