Closed martink2 closed 5 years ago
Please post the steps someone else can take to recreate this issue.
The problem is i cannot re-create the issue on demand ... yet. I just have a lot of user complaints and get around 10 to 15 errors a day like the above mailed to me on a mildly used installation.
So during normal operations from time to time my users get a server error like the above when deleting objects or inventory items.
Closing this out for now as it is not actionable. Please request to have it re-opened if you are able to reliably reproduce the issue.
Re-opening this because it's the earliest report of a symptom which I believe is related to somewhat-randomly recurring bug. It seems that the changelog middleware has been running into the issue described here, where the user associated with the request is not authenticated prior to being captured for the ObjectChange being recorded.
In an effort to document our findings, we noticed develop-2.6
is not experiencing this issue. I ran an overnight endurance test to confirm this. The code changes we tried in #3081, unfortunately, did not work so we investigated what is different in develop-2.6
. Upgrading the Django dependancy to 2.2 is only noticeable change so I reran my endurance test again with 2.2 in develop
with great success.
At this point, we don't have a root cause but we know upgrading to Django 2.2 fixes the problem. Unfortunately, the release notes, don't seem to mention anything related.
So the question is do we pin develop
to Django 2.2 or match the looser dependancy defined in develop-2.6
? @jeremystretch do you know of any other Django changes that would make this problematic?
I don't believe upgrading to Django 2.2 required any changes to NetBox. I think it's reasonable to have the 2.5 train match Django>=2.2,<2.3
to fix this issue.
I think this bug still exists in 2.6.1. I found intermittent failure in Delete operations.
Internal Server Error: /api/dcim/interfaces/29089/
Internal Server Error: /api/dcim/devices/1860/
Internal Server Error: /api/dcim/devices/1865/
Internal Server Error: /api/dcim/devices/1863/
Internal Server Error: /api/ipam/ip-addresses/9202/
Internal Server Error: /api/dcim/devices/1858/
Internal Server Error: /api/dcim/devices/1859/
Internal Server Error: /api/dcim/inventory-items/130823/
Internal Server Error: /api/dcim/devices/1871/
Internal Server Error: /api/dcim/inventory-items/130826/
Internal Server Error: /api/dcim/interfaces/29123/
Internal Server Error: /api/dcim/devices/2007/
Internal Server Error: /api/dcim/devices/2008/
Internal Server Error: /api/dcim/devices/1995/
Internal Server Error: /api/dcim/inventory-items/131278/
Internal Server Error: /api/dcim/devices/2012/
Internal Server Error: /api/dcim/devices/2016/```
[22/Jul/2019 13:23:31] "GET /api/ipam/ip-addresses/?interface_id=29138 HTTP/1.1" 200 52
Internal Server Error: /api/dcim/devices/2016/
Traceback (most recent call last):
File "/opt/netbox/python37/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/opt/netbox/python37/lib/python3.7/site-packages/django/core/handlers/base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/opt/netbox/python37/lib/python3.7/site-packages/django/core/handlers/base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/opt/netbox/python37/lib/python3.7/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "/opt/netbox/python37/lib/python3.7/site-packages/rest_framework/viewsets.py", line 116, in view
return self.dispatch(request, *args, **kwargs)
File "/opt/netbox/netbox-2.6.1/netbox/utilities/api.py", line 279, in dispatch
return super().dispatch(request, *args, **kwargs)
File "/opt/netbox/python37/lib/python3.7/site-packages/rest_framework/views.py", line 495, in dispatch
response = self.handle_exception(exc)
File "/opt/netbox/python37/lib/python3.7/site-packages/rest_framework/views.py", line 455, in handle_exception
self.raise_uncaught_exception(exc)
File "/opt/netbox/python37/lib/python3.7/site-packages/rest_framework/views.py", line 492, in dispatch
response = handler(request, *args, **kwargs)
File "/opt/netbox/python37/lib/python3.7/site-packages/rest_framework/mixins.py", line 93, in destroy
self.perform_destroy(instance)
File "/opt/netbox/python37/lib/python3.7/site-packages/rest_framework/mixins.py", line 97, in perform_destroy
instance.delete()
File "/opt/netbox/python37/lib/python3.7/site-packages/django/db/models/base.py", line 919, in delete
return collector.delete()
File "/opt/netbox/python37/lib/python3.7/site-packages/django/db/models/deletion.py", line 318, in delete
sender=model, instance=obj, using=self.using
File "/opt/netbox/python37/lib/python3.7/site-packages/django/dispatch/dispatcher.py", line 175, in send
for receiver in self._live_receivers(sender)
File "/opt/netbox/python37/lib/python3.7/site-packages/django/dispatch/dispatcher.py", line 175, in <listcomp>
for receiver in self._live_receivers(sender)
File "/opt/netbox/python37/lib/python3.7/site-packages/django/utils/functional.py", line 14, in _curried
return _curried_func(*args, *moreargs, **{**kwargs, **morekwargs})
File "/opt/netbox/netbox-2.6.1/netbox/extras/middleware.py", line 35, in _record_object_deleted
instance.log_change(request.user, request.id, OBJECTCHANGE_ACTION_DELETE)
File "/opt/netbox/netbox-2.6.1/netbox/utilities/models.py", line 36, in log_change
object_data=serialize_object(self)
File "/opt/netbox/python37/lib/python3.7/site-packages/django/db/models/base.py", line 483, in __init__
_setattr(self, field.name, rel_obj)
File "/opt/netbox/python37/lib/python3.7/site-packages/django/db/models/fields/related_descriptors.py", line 211, in __set__
self.field.remote_field.model._meta.object_name,
ValueError: Cannot assign "<SimpleLazyObject: <django.contrib.auth.models.AnonymousUser object at 0x7f1ad13af048>>": "ObjectChange.user" must be a "User" instance.
[22/Jul/2019 13:23:31] "DELETE /api/dcim/devices/2016/ HTTP/1.1" 500 23771```
This issue pertains to an old release of NetBox and has been resolved. If you experience similar issues on the current stable release of NetBox, please open a new issue.
Environment
Steps to Reproduce
My users are reporting that they get intermittent errors deleting or manipulating objects. They get those errors for a couple of minutes and after a couple of minutes the delete operations working fine.
Expected Behavior
The operation should not produce a internal server error.
Observed Behavior
Please find the error info generated when this happens.