Closed bartdebruijn closed 6 years ago
I am getting a similar error on a recent fresh install on Centos Python 3.4.8
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux
Type "help", "copyright", "credits" or "license" for more information.```
I'm now getting this:
`maximum recursion depth exceeded while pickling an object`
I can confirm this issue, but only when running in production. The docs work okay when running via the development server (./manage.py runserver
). Not sure why.
Hi,
I can confirm that the API docs load when running via the development server, albeit it's slow to load. Firefox also complains that a website is slowing the browser down when opening the API docs.
One thing I noted though is that the page loads with all leafs/sections expanded. Is it possible to change this behavior to all collapsed? That might help ease off the load a bit.
I also get a small red section at the bottom of the page Error {...}
and when I click on that I get the following data:
{"schemaValidationMessages":[{"level":"error","message":"Can't read from file https://<webserver>/api/docs/?format=openapi"}]}
Note, I went ahead and upgraded the Python on the server I had just installed Netbox on (Centos 7) from 3.4.8 to 3.6 and now the API docs page is working. So perhaps a difference in Python3.4 and Python3.5 or Python3.6.
We've also noticed that restarting the daemon multiple times will sometimes bring the API docs back, but we're experiencing the same issue.
Here's the trace from running with DEBUG = True
Environment:
Request Method: GET
Request URL: http://my-netbox.local/api/docs/
Django Version: 1.11.12
Python Version: 3.4.0
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',
'django_filters',
'django_tables2',
'mptt',
'rest_framework',
'timezone_field',
'circuits',
'dcim',
'ipam',
'extras',
'secrets',
'tenancy',
'users',
'utilities',
'virtualization',
'drf_yasg')
Installed Middleware:
('debug_toolbar.middleware.DebugToolbarMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
'utilities.middleware.ExceptionHandlingMiddleware',
'utilities.middleware.LoginRequiredMiddleware',
'utilities.middleware.APIVersionMiddleware')
Traceback:
File "/opt/netbox/venv/lib/python3.4/site-packages/django/core/handlers/exception.py" in inner
41. response = get_response(request)
File "/opt/netbox/venv/lib/python3.4/site-packages/django/core/handlers/base.py" in _get_response
217. response = self.process_exception_by_middleware(e, request)
File "/opt/netbox/venv/lib/python3.4/site-packages/django/core/handlers/base.py" in _get_response
215. response = response.render()
File "/opt/netbox/venv/lib/python3.4/site-packages/django/template/response.py" in render
109. newretval = post_callback(retval)
File "/opt/netbox/venv/lib/python3.4/site-packages/django/utils/decorators.py" in callback
163. return middleware.process_response(request, response)
File "/opt/netbox/venv/lib/python3.4/site-packages/django/middleware/cache.py" in process_response
102. lambda r: self.cache.set(cache_key, r, timeout)
File "/opt/netbox/venv/lib/python3.4/site-packages/django/template/response.py" in add_post_render_callback
94. callback(self)
File "/opt/netbox/venv/lib/python3.4/site-packages/django/middleware/cache.py" in <lambda>
102. lambda r: self.cache.set(cache_key, r, timeout)
File "/opt/netbox/venv/lib/python3.4/site-packages/debug_toolbar/panels/cache.py" in wrapped
33. value = method(self, *args, **kwargs)
File "/opt/netbox/venv/lib/python3.4/site-packages/debug_toolbar/panels/cache.py" in set
79. return self.cache.set(*args, **kwargs)
File "/opt/netbox/venv/lib/python3.4/site-packages/django/core/cache/backends/locmem.py" in set
75. pickled = pickle.dumps(value, pickle.HIGHEST_PROTOCOL)
Exception Type: RuntimeError at /api/docs/
Exception Value: maximum recursion depth exceeded while calling a Python object
I also had this with CentOS and the python34* packages - upon upgrading python34-devel to python36-devel the problem disappeared.
I upgraded from Python version: 3.4.5 to Python version: 3.4.8 and the issue persists.
@alejandrosalinas I'm not to keen on upgrading the box to Python 3.6. Did you just upgrade the dev package, or all of it?
@bartdebruijn the only python36 packages that I see in the upgraded host are: python36.x86_64 python36-devel.x86_64 python36-libs.x86_64
Best A.
I can confirm that after installing:
python36.x86_64 python36-devel.x86_64 python36-libs.x86_64
The API docs is working again. It's a bit slow when opening, but at least it works again.
Well, my victory was shortlived :( It's broken again :(
Having the same issue, any update on this?
I am running python3.4.8 on Centos 7
Having the same issue as well. Centos 7 with python 3.4.5-5
Still a problem for me - kinda has halted any integrations we wanted to do with Netbox
@jamieimms What I do as a workaround is either use the API endpoints (e.g. https://myserver.net/api), or look at a standalone lab test server that is running a version of Python that supports the API docs.
It's not ideal, but I am not sure on how to fix it or what exactly is breaking.
This took some digging, but it appears to be an issue with Django's caching as wrapped by drf-yasg specifically on Python 3.4. Testing with Python 3.5 I could not reproduce the issue. I believe the root stems from passing cache_timeout=None
(rather than 0
) in the API URL definitions.
Pretty sure the change I'm about to push will fix it under NetBox v2.3.5, but please comment here if you still experience this issue under NetBox v2.3.5.
2.3.5 fixed this for me
Issue type
[ ] Feature request [X] Bug report [ ] Documentation
Environment
Description
Hi All,
I've upgraded Netbox to v2.3.2 and now I get the error as listed in the screenshot whenever I try to access the API Docs section of Netbox.
The strange thing is that the API itself still works. I can access https://mywebserver.me/api/ but not https://mywebserver.me/api/docs/ as this gives the aforementioned error.
Restarting nginx did not resolve the issue, neither did rebooting the server. The server is running AWS Linux 2.
Anyone have any idea what's wrong?
Kind regards,
Bart