872: Provide better errors for mail notification failure

jeff****@gmai***** (Google Code) (Is this you? Claim this profile.)
March 6, 2010
We're using alpha2.

I think it has something to do with emailing.  I didn't change our email 
settings and every time we hit publish, it says:
"Error: undefined 500 OK
Please try again later. If this continues to happen, please report it to 
your administrator."
in an orange box at the top of the screen.  I hit publish again, and 
everything looks normal, except the email didn't get sent off.
#1 jeff****@gmai***** (Google Code) (Is this you? Claim this profile.)
Oh, look at that, a traceback:


Request Method: POST
Request URL: http://reviews.com/api/json/reviewrequests/143/reviews/175/replies/draft/save/
Django Version: 1.0.2 final
Python Version: 2.5.1
Installed Applications:
Installed Middleware:

File "c:\devtools\python25\lib\site-packages\django-1.0.2_final-py2.5.egg\django\core\handlers\base.py" in get_response
  86.                 response = callback(request, *callback_args, **callback_kwargs)
File "c:\devtools\python25\lib\site-packages\django-1.0.2_final-py2.5.egg\django\views\decorators\cache.py" in _wrapped_view_func
  44.         response = view_func(request, *args, **kwargs)
File "c:\devtools\python25\lib\site-packages\Djblets-0.5alpha2-py2.5.egg\djblets\webapi\decorators.py" in _checklogin
  32.             response = view_func(request, *args, **kwargs)
File "c:\devtools\python25\lib\site-packages\django-1.0.2_final-py2.5.egg\django\views\decorators\http.py" in inner
  31.             return func(request, *args, **kwargs)
File "c:\devtools\python25\lib\site-packages\ReviewBoard-1.0alpha2-py2.5.egg\reviewboard\webapi\json.py" in review_reply_draft_save
  1068.             mail_reply(request.user, reply)
File "c:\devtools\python25\lib\site-packages\ReviewBoard-1.0alpha2-py2.5.egg\reviewboard\reviews\email.py" in mail_reply
  228.                           'reply': reply})
File "c:\devtools\python25\lib\site-packages\ReviewBoard-1.0alpha2-py2.5.egg\reviewboard\reviews\email.py" in send_review_mail
  114.     message.send()
File "c:\devtools\python25\lib\site-packages\django-1.0.2_final-py2.5.egg\django\core\mail.py" in send
  271.         return self.get_connection(fail_silently).send_messages([self])
File "c:\devtools\python25\lib\site-packages\django-1.0.2_final-py2.5.egg\django\core\mail.py" in send_messages
  166.         new_conn_created = self.open()
File "c:\devtools\python25\lib\site-packages\django-1.0.2_final-py2.5.egg\django\core\mail.py" in open
  131.                                            local_hostname=DNS_NAME.get_fqdn())
File "C:\devtools\Python25\lib\smtplib.py" in __init__
  244.             (code, msg) = self.connect(host, port)
File "C:\devtools\Python25\lib\smtplib.py" in connect
  310.             raise socket.error, msg

Exception Type: error at /api/json/reviewrequests/143/reviews/175/replies/draft/save/
Exception Value: (10053, 'Software caused connection abort')
#2 chipx86
I'll need some kind of backtrace to diagnose this. Can you turn on DEBUG = True and
see what error it comes out with?
  • +NeedInfo
#3 jeff****@gmai***** (Google Code) (Is this you? Claim this profile.)
We're already trying to figure out the issue.  Here's what we have so far.

Python can't open a socket connection on localhost:25 because our "server" is blocked on port 25.  We're running it 
on a developer PC right now until our server is set up.  We made a change to email.py to unblock a port using a 
registry hack way back when we started using reviewboard.  We have to do this because once we change the registry 
to modify the domain profile, it gets reset to default after we use it once.  Anyway, we've upgraded several times 
since then, and this is the first time the problem has resurfaced.  Not sure why we haven't seen the regression 
before this.

Perhaps you could make the error message a bit more verbose, ie "Email failed.  Are you sure your mail port isn't 
#4 jeff****@gmai***** (Google Code) (Is this you? Claim this profile.)
We added the port unblocking script back in and it's working fine again.
#5 chipx86
We should certainly do this. This might slip to 1.5, though.
  • -NeedInfo
  • -Priority-Medium
#6 chipx86
  • +Provide better errors for mail notification failure
#7 fen***@gmai***** (Google Code) (Is this you? Claim this profile.)
I do this with middleware catching the smtplib exception:



#8 chipx86
Going to push this out to 1.1.
  • -Milestone-Release1.0
#9 chipx86
#10 chipx86
  • +Milestone-Release1.5
#11 chipx86
  • -Confirmed
  • +chipx86
#12 chipx86
Fixed on master (d2c96d9).
  • -PendingReview