Error occured on virtual chassis deletion #2768

Closed
opened 2025-12-29 18:21:57 +01:00 by adam · 11 comments
Owner

Originally created by @xtprox on GitHub (Jul 31, 2019).

Environment

  • Python version: 3.6.8
  • NetBox version: 2.6.1

Steps to Reproduce

  1. Create two devices
  2. In Devices view select two new devices and click Create Virtual Chassis
  3. Select master, position/priorities 1 and 2 respectively
  4. Validate that virtual chassis has been created
  5. Open Devices view and select one of Virtual chassis members
  6. Delete virtual chassis from Virtual chassis section in device

Expected Behavior

Virtual chassis device deleted

Observed Behavior

Error appears
image

If from Devices view ex-master device selected, it generates the same error.
Ex-master device can be deleted from Devices view.

Originally created by @xtprox on GitHub (Jul 31, 2019). ### Environment * Python version: 3.6.8 * NetBox version: 2.6.1 ### Steps to Reproduce 1. Create two devices 2. In **Devices** view select two new devices and click **Create Virtual Chassis** 3. Select master, position/priorities 1 and 2 respectively 4. Validate that virtual chassis has been created 5. Open **Devices** view and select one of Virtual chassis members 6. Delete virtual chassis from **Virtual chassis** section in device ### Expected Behavior Virtual chassis device deleted ### Observed Behavior Error appears ![image](https://user-images.githubusercontent.com/7577925/62201167-84ba2e00-b38f-11e9-8c8c-ac27aa882bc8.png) If from **Devices** view ex-master device selected, it generates the same error. Ex-master device can be deleted from **Devices** view.
adam closed this issue 2025-12-29 18:21:58 +01:00
Author
Owner

@xtprox commented on GitHub (Jul 31, 2019):

Additionaly email contents (partially) attached that was sent by IPAM

Internal Server Error: /dcim/devices/194/

DoesNotExist at /dcim/devices/194/
VirtualChassis matching query does not exist.

Request Method: GET
Request URL: https://ipam.sanitized.com/dcim/devices/194/
Django Version: 2.2.3
Python Executable: /usr/bin/python3
Python Version: 3.6.8
Python Path: ['/opt/netbox/netbox', '/opt/netbox-2.6.1/netbox', '/usr/local/bin', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/usr/local/lib/python3.6/dist-packages', '/usr/lib/python3/dist-packages'] Server time: Wed, 31 Jul 2019 09:26:55 +0000 Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.humanize',
 'cacheops',
 'corsheaders',
 'debug_toolbar',
 'django_filters',
 'django_tables2',
 'django_prometheus',
 'mptt',
 'rest_framework',
 'taggit',
 'taggit_serializer',
 'timezone_field',
 'circuits',
 'dcim',
 'ipam',
 'extras',
 'secrets',
 'tenancy',
 'users',
 'utilities',
 'virtualization',
 'drf_yasg']
Installed Middleware:
('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',
 'utilities.middleware.ExceptionHandlingMiddleware',
 'utilities.middleware.LoginRequiredMiddleware',
 'utilities.middleware.APIVersionMiddleware',
 'extras.middleware.ObjectChangeMiddleware',
 'django_prometheus.middleware.PrometheusAfterMiddleware')


Traceback:

File "/usr/local/lib/python3.6/dist-packages/django/db/models/fields/related_descriptors.py" in __get__
  164.             rel_obj = self.field.get_cached_value(instance)

File "/usr/local/lib/python3.6/dist-packages/django/db/models/fields/mixins.py" in get_cached_value
  13.             return instance._state.fields_cache[cache_name]

During handling of the above exception ('virtual_chassis'), another exception occurred:

File "/usr/local/lib/python3.6/dist-packages/django/core/handlers/exception.py" in inner
  34.             response = get_response(request)

File "/usr/local/lib/python3.6/dist-packages/django/core/handlers/base.py" in _get_response
  115.                 response = self.process_exception_by_middleware(e, request)

File "/usr/local/lib/python3.6/dist-packages/django/core/handlers/base.py" in _get_response
  113.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/usr/local/lib/python3.6/dist-packages/django/views/generic/base.py" in view
  71.             return self.dispatch(request, *args, **kwargs)

File "/usr/local/lib/python3.6/dist-packages/django/contrib/auth/mixins.py" in dispatch
  85.         return super().dispatch(request, *args, **kwargs)

File "/usr/local/lib/python3.6/dist-packages/django/views/generic/base.py" in dispatch
  97.         return handler(request, *args, **kwargs)

File "/opt/netbox/netbox/dcim/views.py" in get
  929.         if device.virtual_chassis is not None:

File "/usr/local/lib/python3.6/dist-packages/django/db/models/fields/related_descriptors.py" in __get__
  178.                 rel_obj = self.get_object(instance)

File "/usr/local/lib/python3.6/dist-packages/django/db/models/fields/related_descriptors.py" in get_object
  145.         return qs.get(self.field.get_reverse_related_filter(instance))

File "/usr/local/lib/python3.6/dist-packages/cacheops/query.py" in get
  356.         return qs._no_monkey.get(qs, *args, **kwargs)

File "/usr/local/lib/python3.6/dist-packages/django/db/models/query.py" in get
  408.                 self.model._meta.object_name

Exception Type: DoesNotExist at /dcim/devices/194/ Exception Value: VirtualChassis matching query does not exist.
@xtprox commented on GitHub (Jul 31, 2019): Additionaly email contents (partially) attached that was sent by IPAM ``` Internal Server Error: /dcim/devices/194/ DoesNotExist at /dcim/devices/194/ VirtualChassis matching query does not exist. Request Method: GET Request URL: https://ipam.sanitized.com/dcim/devices/194/ Django Version: 2.2.3 Python Executable: /usr/bin/python3 Python Version: 3.6.8 Python Path: ['/opt/netbox/netbox', '/opt/netbox-2.6.1/netbox', '/usr/local/bin', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/usr/local/lib/python3.6/dist-packages', '/usr/lib/python3/dist-packages'] Server time: Wed, 31 Jul 2019 09:26:55 +0000 Installed Applications: ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.humanize', 'cacheops', 'corsheaders', 'debug_toolbar', 'django_filters', 'django_tables2', 'django_prometheus', 'mptt', 'rest_framework', 'taggit', 'taggit_serializer', 'timezone_field', 'circuits', 'dcim', 'ipam', 'extras', 'secrets', 'tenancy', 'users', 'utilities', 'virtualization', 'drf_yasg'] Installed Middleware: ('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', 'utilities.middleware.ExceptionHandlingMiddleware', 'utilities.middleware.LoginRequiredMiddleware', 'utilities.middleware.APIVersionMiddleware', 'extras.middleware.ObjectChangeMiddleware', 'django_prometheus.middleware.PrometheusAfterMiddleware') Traceback: File "/usr/local/lib/python3.6/dist-packages/django/db/models/fields/related_descriptors.py" in __get__ 164. rel_obj = self.field.get_cached_value(instance) File "/usr/local/lib/python3.6/dist-packages/django/db/models/fields/mixins.py" in get_cached_value 13. return instance._state.fields_cache[cache_name] During handling of the above exception ('virtual_chassis'), another exception occurred: File "/usr/local/lib/python3.6/dist-packages/django/core/handlers/exception.py" in inner 34. response = get_response(request) File "/usr/local/lib/python3.6/dist-packages/django/core/handlers/base.py" in _get_response 115. response = self.process_exception_by_middleware(e, request) File "/usr/local/lib/python3.6/dist-packages/django/core/handlers/base.py" in _get_response 113. response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/usr/local/lib/python3.6/dist-packages/django/views/generic/base.py" in view 71. return self.dispatch(request, *args, **kwargs) File "/usr/local/lib/python3.6/dist-packages/django/contrib/auth/mixins.py" in dispatch 85. return super().dispatch(request, *args, **kwargs) File "/usr/local/lib/python3.6/dist-packages/django/views/generic/base.py" in dispatch 97. return handler(request, *args, **kwargs) File "/opt/netbox/netbox/dcim/views.py" in get 929. if device.virtual_chassis is not None: File "/usr/local/lib/python3.6/dist-packages/django/db/models/fields/related_descriptors.py" in __get__ 178. rel_obj = self.get_object(instance) File "/usr/local/lib/python3.6/dist-packages/django/db/models/fields/related_descriptors.py" in get_object 145. return qs.get(self.field.get_reverse_related_filter(instance)) File "/usr/local/lib/python3.6/dist-packages/cacheops/query.py" in get 356. return qs._no_monkey.get(qs, *args, **kwargs) File "/usr/local/lib/python3.6/dist-packages/django/db/models/query.py" in get 408. self.model._meta.object_name Exception Type: DoesNotExist at /dcim/devices/194/ Exception Value: VirtualChassis matching query does not exist. ```
Author
Owner

@jeremystretch commented on GitHub (Jul 31, 2019):

I'm not able to recreate this on v2.6.1. The virtual chassis is deleted as expected without error.

@jeremystretch commented on GitHub (Jul 31, 2019): I'm not able to recreate this on v2.6.1. The virtual chassis is deleted as expected without error.
Author
Owner

@LuPo commented on GitHub (Jul 31, 2019):

I experience the same error as @megazloj

@LuPo commented on GitHub (Jul 31, 2019): I experience the same error as @megazloj
Author
Owner

@jeremystretch commented on GitHub (Jul 31, 2019):

@LuPo please detail the steps necessary to recreate the bug.

@jeremystretch commented on GitHub (Jul 31, 2019): @LuPo please detail the steps necessary to recreate the bug.
Author
Owner

@xtprox commented on GitHub (Aug 1, 2019):

@jeremystretch I've updated actions to reproduce. Also the error recreated on https://master.netbox.dansheps.com/

@xtprox commented on GitHub (Aug 1, 2019): @jeremystretch I've updated actions to reproduce. Also the error recreated on [https://master.netbox.dansheps.com/](https://master.netbox.dansheps.com/)
Author
Owner

@DanSheps commented on GitHub (Aug 4, 2019):

I am wondering if this might be related to caching as well.

I am going to reproduce, disable caching, and reproduce again. Will post results tomorrow.

@DanSheps commented on GitHub (Aug 4, 2019): I am wondering if this might be related to caching as well. I am going to reproduce, disable caching, and reproduce again. Will post results tomorrow.
Author
Owner

@xtprox commented on GitHub (Aug 7, 2019):

FYI, error is also reproducible in NetBox 2.6.2.

@xtprox commented on GitHub (Aug 7, 2019): FYI, error is also reproducible in NetBox 2.6.2.
Author
Owner

@jeremystretch commented on GitHub (Aug 15, 2019):

@DanSheps any update on this?

@jeremystretch commented on GitHub (Aug 15, 2019): @DanSheps any update on this?
Author
Owner

@DanSheps commented on GitHub (Aug 15, 2019):

With Cache:

Create two devices, Test 1 & Test 2
Created VC
Deleted VC
Error received

Without Cache

Create two devices, Test 1 & Test 2
Created VC
Deleted VC
No error

Definitely related to caching. I suspect the cache still returns the fact that it is part of the VC but when the cache is searched for the VC it doesn't exist. So, similar to #3382, but in this case since the object doesn't exist it just fails.

I believe we are planning on just dumping the whole cache when we do writes to the database correct? That should be fix this as well.

@DanSheps commented on GitHub (Aug 15, 2019): With Cache: Create two devices, Test 1 & Test 2 Created VC Deleted VC Error received Without Cache Create two devices, Test 1 & Test 2 Created VC Deleted VC No error Definitely related to caching. I suspect the cache still returns the fact that it is part of the VC but when the cache is searched for the VC it doesn't exist. So, similar to #3382, but in this case since the object doesn't exist it just fails. I believe we are planning on just dumping the whole cache when we do writes to the database correct? That should be fix this as well.
Author
Owner

@jeremystretch commented on GitHub (Aug 15, 2019):

Sounds good to me but I'll defer to @lampwins for his thoughts. We do need to get this fixed sooner rather than later though.

@jeremystretch commented on GitHub (Aug 15, 2019): Sounds good to me but I'll defer to @lampwins for his thoughts. We do need to get this fixed sooner rather than later though.
Author
Owner

@jeremystretch commented on GitHub (Aug 15, 2019):

Rolled into #3428

@jeremystretch commented on GitHub (Aug 15, 2019): Rolled into #3428
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#2768