Opened 3 years ago
Last modified 3 years ago
#33674 closed Bug
Timezones cause 500 errors to not email the site admin — at Version 1
Reported by: | iragm | Owned by: | |
---|---|---|---|
Component: | Error reporting | Version: | 4.0 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
I believe I have found a bug - my site was working great prior to adding support for localization/timezones and if a user encountered a 500 internal server error, I'd get an email about it and could fix it. I added support for timezones, and stopped getting the alert emails -- and the users are no longer sent to my 500 page.
Here's some information:
- debug=True causes things to work correctly (no email sent, debug info displayed to the user)
- this does not happen in a development environment at all as far as I can tell
- I am using Channels and Daphne to serve content behind an Nginx reverse proxy
- Edit: using python3 manage.py runserver with debug=False returns the correct 500 page. This issue is only happening when running with Daphne.
- When 500 errors happen, the user gets redirected to a very generic Daphne "exception inside application" page. Before you blame this on Daphne, please keep reading...
- The error log traceback points to
site-packages/django/templatetags/tz.py
If I change this class to look as follows:
def render(self, context): try: with timezone.override(self.tz.resolve(context)): output = self.nodelist.render(context) return output except: return self.nodelist.render(context)
the correct 500 error page is rendered and the email goes out to me telling me where the error occurred. That suggests to me that something in timezone.override isn't working as it should be.
I could just make a PR with this but I am not really sure what consequences this change has.
I know there's a lack of info in this, and I apologize in advance. Because I only see this issue on my production server, I have to take my whole site down to try to test and troubleshoot it.