Code

Opened 7 months ago

Closed 7 months 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

Description

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/ host=tradecraft.herokuapp.com fwd="50.0.36.150" 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/sync.py", 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/dj_static.py", 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/wsgi.py", 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/smtp.py 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.

Attachments (0)

Change History (1)

comment:1 Changed 7 months ago by timo

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to needsinfo
  • Status changed from new to closed

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!

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.