Opened 3 years ago

Last modified 3 years ago

#33674 closed Bug

Timezones cause 500 errors to not email the site admin — at Initial Version

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

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
  • 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.

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top