Opened 9 years ago

Closed 9 years ago

#21130 closed Uncategorized (needsinfo)

Bad EMAIL_HOST results in cryptic error, no Django 500 page

Reported by: mark@… Owned by: nobody
Component: Core (Mail) Version: 1.6-beta-1
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no


The error itself is not an bug per se as it is the result of mis-configuration, but it took me a long time to diagnose because of the cryptic error. The fact that the 500 error template was not invoked might be a bug. Regardless, handling this error better might prevent others from having their time similarly wasted. The cryptic error:

heroku[router]: at=info method=POST path=/signup/ fwd="" dyno=web.1 connect=10ms service=264ms status=500 bytes=135
app[web.1]: 2013-09-20 15:26:11 [9] [ERROR] Error handling request
app[web.1]: Traceback (most recent call last):
app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/", line 131, in handle_request
app[web.1]: respiter = self.wsgi(environ, resp.start_response)
app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/", line 59, in call
app[web.1]: return self.application(environ, start_response)
app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/handlers/", line 201, in call
app[web.1]: response._handler_class = self.class
app[web.1]: AttributeError: 'NoneType' object has no attribute '_handler_class'

The underlying cause: EMAIL_HOST was set to a FQN that didn't exist, so line 48 of django/core/mail/backends/ which calls smtplib.SMTP() was raising a gaierror from Python's socket library. Somehow this wasn't triggering the usual Django 500 error response, but rather resulted in the WSGI get_response() returning None.

Change History (1)

comment:1 Changed 9 years ago by Tim Graham

Resolution: needsinfo
Status: newclosed

I cannot reproduce this issue on my local machine with gunicorn and the details you've provided. I see dj_static referenced in the traceback which makes me think the problem might be there. If you can provide more details, preferably a minimum project with instructions to reproduce the error, please reopen. Thanks!

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