Closed xtprox closed 5 years ago
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.
I'm not able to recreate this on v2.6.1. The virtual chassis is deleted as expected without error.
I experience the same error as @megazloj
@LuPo please detail the steps necessary to recreate the bug.
@jeremystretch I've updated actions to reproduce. Also the error recreated on https://master.netbox.dansheps.com/
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.
FYI, error is also reproducible in NetBox 2.6.2.
@DanSheps any update on this?
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.
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.
Rolled into #3428
Environment
Steps to Reproduce
Expected Behavior
Virtual chassis device deleted
Observed Behavior
Error appears
If from Devices view ex-master device selected, it generates the same error. Ex-master device can be deleted from Devices view.