Forums

Odd recursion error

I have 2 websites that use exactly the same git repo. One works fine and the other one works for a bit, then just seems to time out, then eventually gives a generic pythonanywhere error screen. If I turn debug on, I get the same error screen.

Looking at the server log

2022-06-25 00:27:28 Sat Jun 25 00:27:28 2022 - SIGPIPE: writing to a closed pipe/socket/fd (probably the client disconnected) on request /logout/ (ip 10.0.0.66) !!!
2022-06-25 00:27:28 Sat Jun 25 00:27:28 2022 - uwsgi_response_writev_headers_and_body_do(): Broken pipe [core/writer.c line 306] during GET /logout/ (10.0.0.66)
2022-06-25 00:27:28 OSError: write error
2022-06-25 00:28:02 Error running WSGI application
2022-06-25 00:28:02 RecursionError: maximum recursion depth exceeded
2022-06-25 00:28:02   File "/home/conceptpyrota/.virtualenvs/supermarketvirtualenv/lib/python3.9/site-packages/django/core/handlers/wsgi.py", line 132, in __call__
2022-06-25 00:28:02     response = self.get_response(request)
2022-06-25 00:28:02 
2022-06-25 00:28:02   File "/home/conceptpyrota/.virtualenvs/supermarketvirtualenv/lib/python3.9/site-packages/django/core/handlers/base.py", line 143, in get_response
2022-06-25 00:28:02     log_response(
2022-06-25 00:28:02 
2022-06-25 00:28:02   File "/home/conceptpyrota/.virtualenvs/supermarketvirtualenv/lib/python3.9/site-packages/django/utils/log.py", line 241, in log_response
2022-06-25 00:28:02     getattr(logger, level)(
2022-06-25 00:28:02 
2022-06-25 00:28:02   File "/usr/local/lib/python3.9/logging/__init__.py", line 1458, in warning
2022-06-25 00:28:02     self._log(WARNING, msg, args, **kwargs)

and the error log

Jun 25 00:27:28 2022 - SIGPIPE: writing to a closed pipe/socket/fd (probably the client disconnected) on request /logout/ (ip 10.0.0.66) !!!
2022-06-25 00:27:28 Sat Jun 25 00:27:28 2022 - uwsgi_response_writev_headers_and_body_do(): Broken pipe [core/writer.c line 306] during GET /logout/ (10.0.0.66)
2022-06-25 00:27:28 OSError: write error
2022-06-25 00:28:02 Error running WSGI application
2022-06-25 00:28:02 RecursionError: maximum recursion depth exceeded
2022-06-25 00:28:02   File "/home/conceptpyrota/.virtualenvs/supermarketvirtualenv/lib/python3.9/site-packages/django/core/handlers/wsgi.py", line 132, in __call__
2022-06-25 00:28:02     response = self.get_response(request)
2022-06-25 00:28:02 
2022-06-25 00:28:02   File "/home/conceptpyrota/.virtualenvs/supermarketvirtualenv/lib/python3.9/site-packages/django/core/handlers/base.py", line 143, in get_response
2022-06-25 00:28:02     log_response(
2022-06-25 00:28:02 
2022-06-25 00:28:02   File "/home/conceptpyrota/.virtualenvs/supermarketvirtualenv/lib/python3.9/site-packages/django/utils/log.py", line 241, in log_response
2022-06-25 00:28:02     getattr(logger, level)(
2022-06-25 00:28:02 
2022-06-25 00:28:02   File "/usr/local/lib/python3.9/logging/__init__.py", line 1458, in warning
2022-06-25 00:28:02     self._log(WARNING, msg, args, **kwargs)
2022-06-25 00:28:02 
2022-06-25 00:28:02   File "/usr/local/lib/python3.9/logging/__init__.py", line 1589, in _log
2022-06-25 00:28:02     self.handle(record)

spammed over and over. Like I mentioned the other site with the same code base works fine. The only difference is the data in the database. Any ideas what I should attempt to determine the problem? I can't tell whats going on from the log apart from some type of recursion error going on somewhere. The only significant thing I added was django_debug_toolbar, but I set debug to False so it wouldn't operate. Could that the the issue?

It looks like you copied only the bits from the server log -- could you share also relevant parts from the error log?

Its ok. I removed the django_debug_toolbar app from the installed_apps in settings.py file and now it works correctly. So I assume there is something in django debug toolbar that is not playing nice. Since I would never want to run this in production anyway, I just coded it so it appends to that setting when I run on the local machine instead of simply setting debug=False.

Glad you solved it -- and thanks for sharing the solution!

Same thing happened to me. I forgot to remove django_debug_toolbar app when I deployed the app. Thank you

Glad to hear that you were able to fix it!

thanks a bunch for sharing the solution, removing django_debug_toolbar also resolved my problem.